diff options
author | nick_m <mainsbridge@gmail.com> | 2017-03-01 01:58:53 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2017-03-01 01:58:53 +1100 |
commit | 38b5d887950e72a65341d616bf40195657228271 (patch) | |
tree | 4458a00751af2460e02711495d6a0cb18616ca64 /libs | |
parent | a9bb1afb27e90466f1fd73372f1c016401148cac (diff) |
allow continuation of tempo via right-click 'Continue' where appropriate.
- this is the opposite of 'Ramp to Next'.
it removes discontinuities between the
last end tempo and the current by altering the current one.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/tempo.h | 1 | ||||
-rw-r--r-- | libs/ardour/tempo.cc | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 1426801f24..b1c2dc6428 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -367,6 +367,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible const MeterSection& meter_section_at_frame (framepos_t frame) const; const MeterSection& meter_section_at_beat (double beat) const; + TempoSection* previous_tempo_section (TempoSection*) const; TempoSection* next_tempo_section (TempoSection*) const; /** add a tempo section locked to pls. ignored values will be set in recompute_tempi() diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 345d09b8bf..e11d28bd98 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -4286,6 +4286,43 @@ TempoMap::tempo_section_at_beat_locked (const Metrics& metrics, const double& be } TempoSection* +TempoMap::previous_tempo_section (TempoSection* ts) const +{ + if (!ts) { + return 0; + } + + Glib::Threads::RWLock::ReaderLock lm (lock); + + TempoSection* prev = 0; + + for (Metrics::const_iterator i = _metrics.begin(); i != _metrics.end(); ++i) { + + if ((*i)->is_tempo()) { + TempoSection* t = static_cast<TempoSection*> (*i); + + if (!t->active()) { + continue; + } + + if (prev && t == ts) { + + return prev; + } + + prev = t; + } + } + + if (prev == 0) { + fatal << endmsg; + abort(); /*NOTREACHED*/ + } + + return 0; +} + +TempoSection* TempoMap::next_tempo_section (TempoSection* ts) const { if (!ts) { |