diff options
author | nick_m <mainsbridge@gmail.com> | 2015-12-24 05:59:36 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:09 +1000 |
commit | 41c8b534b70e220b4d4b940aed8a98d9a57003ab (patch) | |
tree | 7c21ce9fcd78f13100d4ce5717c31c8b7051afb5 | |
parent | 8d007e8a77f9d3225fae72324b788ab74d68ed2b (diff) |
Tempo ramps - amend previous commit.
-rw-r--r-- | libs/ardour/tempo.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 73e27a2814..8dd2e28073 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -673,8 +673,6 @@ TempoMap::gui_set_tempo_frame (TempoSection& ts, framepos_t frame) { TempoSection& first (first_tempo()); if (ts.frame() != first.frame()) { - const MeterSection* meter = &meter_section_at (frame); - BBT_Time bbt; { Glib::Threads::RWLock::WriterLock lm (lock); @@ -686,8 +684,11 @@ TempoMap::gui_set_tempo_frame (TempoSection& ts, framepos_t frame) Metrics::const_iterator i; TempoSection* prev_ts = 0; + MeterSection* meter = 0; + for (i = metrics.begin(); i != metrics.end(); ++i) { TempoSection* t; + MeterSection* m; if ((t = dynamic_cast<TempoSection*> (*i)) != 0) { @@ -697,9 +698,18 @@ TempoMap::gui_set_tempo_frame (TempoSection& ts, framepos_t frame) prev_ts = t; } + + if ((m = dynamic_cast<MeterSection*> (*i)) != 0) { + + if ((*i)->frame() > frame) { + break; + } + + meter = m; + } } - if (prev_ts) { + if (prev_ts && meter) { /* set the start bbt */ double const ticks_to_ts = prev_ts->tick_at_frame (frame - prev_ts->frame(), ts.beats_per_minute(), frame - prev_ts->frame(), _frame_rate); |