diff options
author | nick_m <mainsbridge@gmail.com> | 2017-06-09 11:01:30 +1000 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2017-06-09 11:01:30 +1000 |
commit | 4ef4f45f3d8812bf6f9b45e06e77e844ce0ce536 (patch) | |
tree | 696c13563bfd0fb2079d44d057fd2f77e8204d6b | |
parent | 789fcff1fe50ccf07904d43591874c509ef206c6 (diff) |
Add a method for obtaining the frame position of beat/whatever zero
-rw-r--r-- | libs/ardour/ardour/tempo.h | 2 | ||||
-rw-r--r-- | libs/ardour/tempo.cc | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index da68f6516e..816ec67d33 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -525,6 +525,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible void fix_legacy_session(); void fix_legacy_end_session(); + framepos_t music_origin (); + private: /* prevent copy construction */ TempoMap (TempoMap const&); diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 47d718d2f8..405a13a851 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1882,7 +1882,7 @@ TempoMap::quarter_note_at_tempo (const Tempo& tempo) const { Glib::Threads::RWLock::ReaderLock lm (lock); - return pulse_at_tempo_locked (_metrics, tempo) * 4.0;; + return pulse_at_tempo_locked (_metrics, tempo) * 4.0; } /** Returns the whole-note pulse corresponding to the supplied BBT (meter-based) beat. @@ -3780,6 +3780,16 @@ TempoMap::gui_twist_tempi (TempoSection* ts, const Tempo& bpm, const framepos_t return can_solve; } + +/** Returns the frame position of the musical position zero */ +framepos_t +TempoMap::music_origin () +{ + Glib::Threads::RWLock::ReaderLock lm (lock); + + return first_tempo().frame(); +} + /** Returns the exact bbt-based beat corresponding to the bar, beat or quarter note subdivision nearest to * the supplied frame, possibly returning a negative value. * |