Add a method for obtaining the frame position of beat/whatever zero
authornick_m <mainsbridge@gmail.com>
Fri, 9 Jun 2017 01:01:30 +0000 (11:01 +1000)
committernick_m <mainsbridge@gmail.com>
Fri, 9 Jun 2017 01:01:30 +0000 (11:01 +1000)
libs/ardour/ardour/tempo.h
libs/ardour/tempo.cc

index da68f6516e127e0af653a1068653bd3600e31ae9..816ec67d3345df68bda829bb5c000286a485755d 100644 (file)
@@ -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&);
index 47d718d2f8d95b9bd678c135420a12dd4a90c8aa..405a13a851c5514a300ba25f2004c560d366f87d 100644 (file)
@@ -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.
  *