summaryrefslogtreecommitdiff
path: root/libs/ardour/tempo.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2017-03-01 01:58:53 +1100
committernick_m <mainsbridge@gmail.com>2017-03-01 01:58:53 +1100
commit38b5d887950e72a65341d616bf40195657228271 (patch)
tree4458a00751af2460e02711495d6a0cb18616ca64 /libs/ardour/tempo.cc
parenta9bb1afb27e90466f1fd73372f1c016401148cac (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/ardour/tempo.cc')
-rw-r--r--libs/ardour/tempo.cc37
1 files changed, 37 insertions, 0 deletions
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) {