diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index 33ce1805d1..dc30f79e3e 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -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); void startup (); void jump_start (); diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index 01de7f3eac..f27ecdb05c 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -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) {