Fix warnings
[ardour.git] / libs / ardour / tempo.cc
index 65299587fe0958d4170abc8bdeb6bf262e0a89f6..41c08ae675b11bdca0d5eee1664d03e1671fc028 100644 (file)
@@ -2326,7 +2326,7 @@ TempoMap::minute_at_quarter_note_locked (const Metrics& metrics, const double qu
  *
  */
 double
-TempoMap::quarter_note_at_beat (const double beat)
+TempoMap::quarter_note_at_beat (const double beat) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
@@ -2351,7 +2351,7 @@ TempoMap::quarter_note_at_beat_locked (const Metrics& metrics, const double beat
  *
  */
 double
-TempoMap::beat_at_quarter_note (const double quarter_note)
+TempoMap::beat_at_quarter_note (const double quarter_note) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
@@ -3409,7 +3409,7 @@ TempoMap::gui_dilate_tempo (TempoSection* ts, const framepos_t& frame, const fra
  * This function is sensitive to tempo and meter.
  */
 double
-TempoMap::exact_beat_at_frame (const framepos_t& frame, const int32_t sub_num)
+TempoMap::exact_beat_at_frame (const framepos_t& frame, const int32_t sub_num) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
@@ -3417,7 +3417,7 @@ TempoMap::exact_beat_at_frame (const framepos_t& frame, const int32_t sub_num)
 }
 
 double
-TempoMap::exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t& frame, const int32_t divisions)
+TempoMap::exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t& frame, const int32_t divisions) const
 {
        return beat_at_pulse_locked (_metrics, exact_qn_at_frame_locked (metrics, frame, divisions) / 4.0);
 }
@@ -3445,7 +3445,7 @@ TempoMap::exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t&
  * This function is tempo-sensitive.
  */
 double
-TempoMap::exact_qn_at_frame (const framepos_t& frame, const int32_t sub_num)
+TempoMap::exact_qn_at_frame (const framepos_t& frame, const int32_t sub_num) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
@@ -3453,7 +3453,7 @@ TempoMap::exact_qn_at_frame (const framepos_t& frame, const int32_t sub_num)
 }
 
 double
-TempoMap::exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t& frame, const int32_t sub_num)
+TempoMap::exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t& frame, const int32_t sub_num) const
 {
        double qn = quarter_note_at_minute_locked (metrics, minute_at_frame (frame));
 
@@ -3494,7 +3494,6 @@ TempoMap::bbt_duration_at (framepos_t pos, const BBT_Time& bbt, int dir)
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
        BBT_Time pos_bbt = bbt_at_minute_locked (_metrics, minute_at_frame (pos));
-       const framecnt_t offset = frame_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
 
        const double divisions = meter_section_at_minute_locked (_metrics, minute_at_frame (pos)).divisions_per_bar();
 
@@ -3512,16 +3511,10 @@ TempoMap::bbt_duration_at (framepos_t pos, const BBT_Time& bbt, int dir)
                        pos_bbt.bars += 1;
                        pos_bbt.beats -= divisions;
                }
-               const framecnt_t music_origin = frame_at_minute (minute_at_bbt_locked (_metrics, BBT_Time (1, 1, 0)));
                const framecnt_t pos_bbt_frame = frame_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
 
-               if (pos < music_origin) {
+               return pos_bbt_frame - pos;
 
-                       return pos_bbt_frame - pos;
-               } else {
-
-                       return pos_bbt_frame - offset;
-               }
        } else {
 
                if (pos_bbt.bars <= bbt.bars) {
@@ -3558,7 +3551,7 @@ TempoMap::bbt_duration_at (framepos_t pos, const BBT_Time& bbt, int dir)
                        pos_bbt.beats -= bbt.beats;
                }
 
-               return offset - frame_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
+               return pos - frame_at_minute (minute_at_bbt_locked (_metrics, pos_bbt));
        }
 
        return 0;