From 7ab9f36c8aadfdb78c975473a0960e3f42dc3a2a Mon Sep 17 00:00:00 2001 From: nick_m Date: Fri, 27 May 2016 10:22:51 +1000 Subject: [PATCH] Tempo ramps - comments, --- libs/ardour/tempo.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index c1cd9e9d7c..8a23512c1b 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1524,6 +1524,9 @@ TempoMap::frame_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) con return prev_t->frame(); } +/** more precise than doing tempo_at_frame (frame_at_beat (b)), + * as there is no intermediate frame rounding. + */ Tempo TempoMap::tempo_at_beat (const double& beat) const { @@ -1987,6 +1990,7 @@ TempoMap::solve_map_frame (Metrics& imaginary, TempoSection* section, const fram TempoSection* section_prev = 0; framepos_t first_m_frame = 0; + /* can't move a tempo before the first meter */ for (Metrics::iterator i = imaginary.begin(); i != imaginary.end(); ++i) { MeterSection* m; if ((m = dynamic_cast (*i)) != 0) { @@ -2140,10 +2144,8 @@ TempoMap::solve_map_frame (Metrics& imaginary, MeterSection* section, const fram } } - /* it would make sense to bail out if there is no audio-locked meter, - however it may be desirable to move a music-locked meter by frame at some point. - */ TempoSection* meter_locked_tempo = 0; + for (Metrics::const_iterator ii = imaginary.begin(); ii != imaginary.end(); ++ii) { TempoSection* t; if ((t = dynamic_cast (*ii)) != 0) { @@ -2197,7 +2199,10 @@ TempoMap::solve_map_frame (Metrics& imaginary, MeterSection* section, const fram return false; } } else { - /* all is ok. set section's tempo */ + /* all is ok. set section's locked tempo if allowed. + possibly disallowed if there is an adjacent audio-locked tempo. + XX this check could possibly go. its never actually happened here. + */ MeterSection* meter_copy = const_cast (&meter_section_at_frame_locked (future_map, section->frame())); meter_copy->set_frame (frame);