From 9bb119e0b577dd341a7a154b6a318d6f10c2fdc6 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 13 May 2008 16:13:51 -0500 Subject: [PATCH] Get BBT info right. --- Timeline/Timeline.C | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index b205a21..6aab41c 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -393,14 +393,6 @@ Timeline::solve_tempomap ( nframes_t when ) for ( list ::iterator i = tempo_map.begin(); i != tempo_map.end(); ++i ) { - nframes_t next; - - { - list ::iterator n = i; - ++n; - - next = n != tempo_map.end() ? (*n)->start() : when; - } if ( ! strcmp( (*i)->class_name(), "Tempo_Point" ) ) { @@ -416,6 +408,17 @@ Timeline::solve_tempomap ( nframes_t when ) sig = p->time(); } + nframes_t next; + + { + list ::iterator n = i; + ++n; + if ( n == tempo_map.end() ) + next = when; + else + next = min( (*n)->start(), when ); + } + for ( ; f < next; f += beat_inc ) { if ( ++bbt.beat == sig.beats_per_bar ) @@ -427,8 +430,11 @@ Timeline::solve_tempomap ( nframes_t when ) // const int x = ts_to_x( f - xoffset ) + Track::width(); if ( f >= when ) - return bbt; + break; + } + + return bbt; }