summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2017-02-16 04:58:45 +1100
committernick_m <mainsbridge@gmail.com>2017-02-16 04:58:45 +1100
commit32248b755ba874eef55a59a66a94de2ee58a4ad9 (patch)
treebeb2bd4a48dc3eca62c98fc080d60b97385f80c8 /libs
parent61ae00ed237adb043821622171f6b09f23f1c82d (diff)
fix loading of 4.x sessions with a missing initial tempo section.
- behaviour should match that of 4.x (move the first tempo to frame 0).
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/tempo.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index cd0904a050..9cefb9408a 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -4135,6 +4135,7 @@ TempoMap::fix_legacy_session ()
{
MeterSection* prev_m = 0;
TempoSection* prev_t = 0;
+ bool have_initial_t = false;
for (Metrics::iterator i = _metrics.begin(); i != _metrics.end(); ++i) {
MeterSection* m;
@@ -4173,10 +4174,20 @@ TempoMap::fix_legacy_session ()
t->set_minute (0.0);
t->set_position_lock_style (AudioTime);
prev_t = t;
+ have_initial_t = true;
continue;
}
if (prev_t) {
+ /* some 4.x sessions have no initial (non-movable) tempo. */
+ if (!have_initial_t) {
+ prev_t->set_pulse (0.0);
+ prev_t->set_minute (0.0);
+ prev_t->set_position_lock_style (AudioTime);
+ t->set_initial (true);
+ have_initial_t = true;
+ }
+
const double beat = ((t->legacy_bbt().bars - 1) * ((prev_m) ? prev_m->note_divisor() : 4.0))
+ (t->legacy_bbt().beats - 1)
+ (t->legacy_bbt().ticks / BBT_Time::ticks_per_beat);