trigger: add method to get position while playing as a fraction
This commit is contained in:
parent
a1699ff612
commit
5caed9b0a6
@ -79,6 +79,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
|
||||
/* this accepts timepos_t because the origin is assumed to be the start */
|
||||
virtual void set_length (timepos_t const &) = 0;
|
||||
|
||||
virtual double position_as_fraction() const = 0;
|
||||
|
||||
void set_use_follow (bool yn);
|
||||
bool use_follow() const { return _use_follow; }
|
||||
|
||||
@ -210,6 +212,8 @@ class LIBARDOUR_API AudioTrigger : public Trigger {
|
||||
timepos_t current_length() const; /* offset from start of data */
|
||||
timepos_t natural_length() const; /* offset from start of data */
|
||||
|
||||
double position_as_fraction() const;
|
||||
|
||||
int set_region (boost::shared_ptr<Region>);
|
||||
void startup ();
|
||||
void jump_start ();
|
||||
|
@ -434,6 +434,16 @@ AudioTrigger::jump_stop ()
|
||||
retrigger ();
|
||||
}
|
||||
|
||||
double
|
||||
AudioTrigger::position_as_fraction () const
|
||||
{
|
||||
if (!active()) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return read_index / (double) usable_length;
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
AudioTrigger::get_state (void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user