diff options
author | nick_m <mainsbridge@gmail.com> | 2016-03-14 05:26:34 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:11 +1000 |
commit | a47359c38280398acc80494cdc72ce129ae0edc3 (patch) | |
tree | fc657560f47881606fa4620fb664628f2c414335 | |
parent | d3c24fe0ca54cce155ec35429ffcf38dcb34d645 (diff) |
Tempo ramps - fix erroneous tempo_at_frame(), use correct type for offsets.
-rw-r--r-- | libs/ardour/ardour/tempo.h | 2 | ||||
-rw-r--r-- | libs/ardour/tempo.cc | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index a73379b62f..813c96e8af 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -436,7 +436,7 @@ private: framecnt_t frame_at_beat_locked (const Metrics& metrics, double beat) const; double tick_at_frame_locked (const Metrics& metrics, framecnt_t frame) const; - double tick_offset_at (const Metrics& metrics, double tick) const; + double beat_offset_at (const Metrics& metrics, double beat) const; frameoffset_t frame_offset_at (const Metrics& metrics, framepos_t frame) const; framecnt_t frame_at_tick_locked (const Metrics& metrics, double tick) const; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 7c4ffd6a10..f8c1fe2a67 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1507,7 +1507,7 @@ TempoMap::bbt_time (framepos_t frame, BBT_Time& bbt) return; } Glib::Threads::RWLock::ReaderLock lm (lock); - framepos_t const frame_off = frame_offset_at (_metrics, frame); + frameoffset_t const frame_off = frame_offset_at (_metrics, frame); double const beats = beat_at_frame_locked (_metrics, frame + frame_off); bbt = beats_to_bbt_locked (_metrics, beats); @@ -1683,7 +1683,7 @@ TempoMap::frame_at_tick_locked (const Metrics& metrics, double tick) const } double -TempoMap::tick_offset_at (const Metrics& metrics, double tick) const +TempoMap::beat_offset_at (const Metrics& metrics, double beat) const { MeterSection* prev_m = 0; double beat_off = 0.0; @@ -1691,7 +1691,7 @@ TempoMap::tick_offset_at (const Metrics& metrics, double tick) const for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) { MeterSection* m = 0; if ((m = dynamic_cast<MeterSection*> (*i)) != 0) { - if (m->tick() > tick) { + if (m->beat() > beat) { break; } @@ -1747,7 +1747,7 @@ TempoMap::frame_at_beat (double beat) const { Glib::Threads::RWLock::ReaderLock lm (lock); framecnt_t const frame = frame_at_beat_locked (_metrics, beat); - framecnt_t const frame_off = frame_offset_at (_metrics, frame); + frameoffset_t const frame_off = frame_offset_at (_metrics, frame); return frame - frame_off; } @@ -1772,7 +1772,7 @@ TempoMap::frame_time (const BBT_Time& bbt) Glib::Threads::RWLock::ReaderLock lm (lock); framecnt_t const frame = frame_at_beat_locked (_metrics, bbt_to_beats_locked (_metrics, bbt)); - framecnt_t const frame_off = frame_offset_at (_metrics, frame); + frameoffset_t const frame_off = frame_offset_at (_metrics, frame); return frame - frame_off; } @@ -2275,10 +2275,10 @@ TempoMap::get_grid (vector<TempoMap::BBTPoint>& points, while (cnt <= upper_beat) { framecnt_t pos = frame_at_beat_locked (_metrics, cnt); Tempo const tempo = tempo_at (pos); + MeterSection const meter = meter_section_at (pos); frameoffset_t const frame_offset = frame_offset_at (_metrics, pos); pos -= frame_offset; - MeterSection const meter = meter_section_at (pos); BBT_Time const bbt = beats_to_bbt_locked (_metrics, (double) cnt); @@ -2359,9 +2359,9 @@ TempoMap::tempo_at (framepos_t frame) const for (i = _metrics.begin(); i != _metrics.end(); ++i) { TempoSection* t; if ((t = dynamic_cast<TempoSection*> (*i)) != 0) { - if ((prev_ts) && t->frame() > frame_off) { + if ((prev_ts) && t->frame() > frame) { /* this is the one past frame */ - double const ret = prev_ts->tempo_at_frame (frame_off, _frame_rate); + double const ret = prev_ts->tempo_at_frame (frame, _frame_rate); Tempo const ret_tempo (ret, prev_ts->note_type()); return ret_tempo; } |