From 1cd36adce87a9d80ca9b100beddca9e1f02023ea Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 14 May 2008 13:43:12 -0500 Subject: [PATCH] Improve tempomap rendering. --- Timeline/Timeline.C | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index 1050739..04dd118 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -399,6 +399,7 @@ Timeline::render_tempomap( nframes_t start, nframes_t length, measure_line_callb sig.beat_type = 4; nframes_t f = 0; + nframes_t next = 0; nframes_t frames_per_beat = samples_per_minute / bpm; @@ -420,17 +421,18 @@ Timeline::render_tempomap( nframes_t start, nframes_t length, measure_line_callb sig = p->time(); } - nframes_t next; - { list ::iterator n = i; ++n; if ( n == tempo_map.end() ) next = end; else - next = min( (*n)->start(), end ); +// next = min( (*n)->start(), end ); + /* points may not always be aligned with beat boundaries, so we must align here */ + next = (*n)->start() - ( ( (*n)->start() - (*i)->start() ) % frames_per_beat ); } + for ( ; f < next; f += frames_per_beat ) { if ( ++bbt.beat == sig.beats_per_bar ) @@ -471,7 +473,6 @@ done: /* FIXME: this this right? */ const nframes_t frames_per_tick = frames_per_beat / ticks_per_beat; - bbt.tick = ticks_per_beat - ( ( ( f - end ) / frames_per_tick ) % (nframes_t)ticks_per_beat ); return pos;