diff options
author | nick_m <mainsbridge@gmail.com> | 2016-04-01 02:12:34 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:13 +1000 |
commit | c8fe6733cda0d848a2929dc52c8e60d9176e20fd (patch) | |
tree | 24bcba1433af049c05681982b8c2d03bc0ac1148 | |
parent | 324e51c73431199c25f7be390aafd964aa3d7c86 (diff) |
Tempo ramps - fix some silly code.
-rw-r--r-- | libs/ardour/tempo.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index f613336808..218289dcc9 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1475,9 +1475,8 @@ TempoMap::bbt_to_beats_locked (const Metrics& metrics, const Timecode::BBT_Time& for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) { MeterSection* m; if ((m = dynamic_cast<MeterSection*> (*i)) != 0) { - double bars_to_m = 0.0; if (prev_ms) { - bars_to_m = (m->beat() - prev_ms->beat()) / prev_ms->divisions_per_bar(); + const double bars_to_m = (m->beat() - prev_ms->beat()) / prev_ms->divisions_per_bar(); if ((bars_to_m + accumulated_bars) > (bbt.bars - 1)) { break; } @@ -1518,12 +1517,11 @@ TempoMap::beats_to_bbt_locked (const Metrics& metrics, const double& b) const if ((m = dynamic_cast<MeterSection*> (*i)) != 0) { if (prev_ms) { - double const beats_to_m = m->beat() - prev_ms->beat(); - if (accumulated_beats + beats_to_m > beats) { + if (m->beat() > beats) { /* this is the meter after the one our beat is on*/ break; } - + const double beats_to_m = m->beat() - prev_ms->beat(); /* we need a whole number of bars. */ accumulated_bars += (beats_to_m + 1) / prev_ms->divisions_per_bar(); accumulated_beats += beats_to_m; @@ -1733,7 +1731,7 @@ TempoMap::frame_time_locked (const Metrics& metrics, const BBT_Time& bbt) const { /* HOLD THE READER LOCK */ - framepos_t const ret = frame_at_pulse_locked (metrics, pulse_at_beat_locked (metrics, bbt_to_beats_locked (metrics, bbt))); + framepos_t const ret = frame_at_beat_locked (metrics, bbt_to_beats_locked (metrics, bbt)); return ret; } |