From 11a68f7dd38e72c3e497569a60cb0740a33b78cf Mon Sep 17 00:00:00 2001 From: nick_m Date: Wed, 31 Aug 2016 04:30:34 +1000 Subject: [PATCH] Amend f3c0c1a865 (Add quarter-note position methods). --- libs/ardour/ardour/tempo.h | 6 +++--- libs/ardour/tempo.cc | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 77eff92fa8..ab52e8e839 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -495,9 +495,9 @@ private: double pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const; Timecode::BBT_Time bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const; - framepos_t frame_at_quarter_note_locked (const Metrics& metrics, const double quarter_note); - double quarter_note_at_frame_locked (const Metrics& metrics, const framepos_t frame); - double quarter_note_at_beat_locked (const Metrics& metrics, const double beat); + framepos_t frame_at_quarter_note_locked (const Metrics& metrics, const double quarter_note) const; + double quarter_note_at_frame_locked (const Metrics& metrics, const framepos_t frame) const; + double quarter_note_at_beat_locked (const Metrics& metrics, const double beat) const; const TempoSection& tempo_section_at_frame_locked (const Metrics& metrics, framepos_t frame) const; const TempoSection& tempo_section_at_beat_locked (const Metrics& metrics, const double& beat) const; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index de220b6ed7..3229f8c7ba 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -2112,7 +2112,7 @@ TempoMap::quarter_note_at_frame (const framepos_t frame) } double -TempoMap::quarter_note_at_frame_locked (const Metrics& metrics, const framepos_t frame) +TempoMap::quarter_note_at_frame_locked (const Metrics& metrics, const framepos_t frame) const { const double ret = pulse_at_frame_locked (metrics, frame) * 4.0; @@ -2144,7 +2144,7 @@ TempoMap::frame_at_quarter_note (const double quarter_note) } framepos_t -TempoMap::frame_at_quarter_note_locked (const Metrics& metrics, const double quarter_note) +TempoMap::frame_at_quarter_note_locked (const Metrics& metrics, const double quarter_note) const { const framepos_t ret = frame_at_pulse_locked (metrics, quarter_note / 4.0); @@ -2162,7 +2162,7 @@ TempoMap::quarter_note_at_beat (const double beat) } double -TempoMap::quarter_note_at_beat_locked (const Metrics& metrics, const double beat) +TempoMap::quarter_note_at_beat_locked (const Metrics& metrics, const double beat) const { const double ret = pulse_at_beat_locked (metrics, beat) * 4.0; @@ -4082,11 +4082,11 @@ TempoMap::framepos_plus_beats (framepos_t frame, Evoral::Beats beats) const return frame_at_beat_locked (_metrics, beat_at_frame_locked (_metrics, frame) + beats.to_double()); } framepos_t -TempoMap::framepos_plus_qn (framepos_t frame, Evoral::Beats beats) const +TempoMap::framepos_plus_qn (framepos_t frame, Evoral::Beats quarter_note) const { Glib::Threads::RWLock::ReaderLock lm (lock); - return frame_at_beat_locked (_metrics, beat_at_frame_locked (_metrics, frame) + beats.to_double()); + return frame_at_quarter_note_locked (_metrics, quarter_note_at_frame_locked (_metrics, frame) + quarter_note.to_double()); } /** Subtract some (fractional) beats from a frame position, and return the result in frames */ @@ -4139,7 +4139,7 @@ TempoMap::framewalk_to_qn (framepos_t pos, framecnt_t distance) const { Glib::Threads::RWLock::ReaderLock lm (lock); - return Evoral::Beats (beat_at_frame_locked (_metrics, pos + distance) - beat_at_frame_locked (_metrics, pos)); + return Evoral::Beats (quarter_note_at_frame_locked (_metrics, pos + distance) - quarter_note_at_frame_locked (_metrics, pos)); } struct bbtcmp { bool operator() (const BBT_Time& a, const BBT_Time& b) {