mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
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).
This commit is contained in:
parent
61ae00ed23
commit
32248b755b
1 changed files with 11 additions and 0 deletions
|
|
@ -4135,6 +4135,7 @@ TempoMap::fix_legacy_session ()
|
||||||
{
|
{
|
||||||
MeterSection* prev_m = 0;
|
MeterSection* prev_m = 0;
|
||||||
TempoSection* prev_t = 0;
|
TempoSection* prev_t = 0;
|
||||||
|
bool have_initial_t = false;
|
||||||
|
|
||||||
for (Metrics::iterator i = _metrics.begin(); i != _metrics.end(); ++i) {
|
for (Metrics::iterator i = _metrics.begin(); i != _metrics.end(); ++i) {
|
||||||
MeterSection* m;
|
MeterSection* m;
|
||||||
|
|
@ -4173,10 +4174,20 @@ TempoMap::fix_legacy_session ()
|
||||||
t->set_minute (0.0);
|
t->set_minute (0.0);
|
||||||
t->set_position_lock_style (AudioTime);
|
t->set_position_lock_style (AudioTime);
|
||||||
prev_t = t;
|
prev_t = t;
|
||||||
|
have_initial_t = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev_t) {
|
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))
|
const double beat = ((t->legacy_bbt().bars - 1) * ((prev_m) ? prev_m->note_divisor() : 4.0))
|
||||||
+ (t->legacy_bbt().beats - 1)
|
+ (t->legacy_bbt().beats - 1)
|
||||||
+ (t->legacy_bbt().ticks / BBT_Time::ticks_per_beat);
|
+ (t->legacy_bbt().ticks / BBT_Time::ticks_per_beat);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue