Include tick ibn BBT info.

This commit is contained in:
Jonathan Moore Liles 2008-05-13 16:38:13 -05:00
parent 9bb119e0b5
commit 6dd66f328f
1 changed files with 9 additions and 3 deletions

View File

@ -351,6 +351,9 @@ struct Measure_Line
}; };
#endif #endif
/* FIXME wrong place for this */
const float ticks_per_beat = 1920.0;
BBT BBT
Timeline::solve_tempomap ( nframes_t when ) Timeline::solve_tempomap ( nframes_t when )
{ {
@ -388,7 +391,7 @@ Timeline::solve_tempomap ( nframes_t when )
nframes_t f = 0; nframes_t f = 0;
nframes_t beat_inc = samples_per_minute / bpm; nframes_t frames_per_beat = samples_per_minute / bpm;
for ( list <Sequence_Widget *>::iterator i = tempo_map.begin(); for ( list <Sequence_Widget *>::iterator i = tempo_map.begin();
i != tempo_map.end(); ++i ) i != tempo_map.end(); ++i )
@ -399,7 +402,7 @@ Timeline::solve_tempomap ( nframes_t when )
const Tempo_Point *p = (Tempo_Point*)(*i); const Tempo_Point *p = (Tempo_Point*)(*i);
bpm = p->tempo(); bpm = p->tempo();
beat_inc = samples_per_minute / bpm; frames_per_beat = samples_per_minute / bpm;
} }
else else
{ {
@ -419,7 +422,7 @@ Timeline::solve_tempomap ( nframes_t when )
next = min( (*n)->start(), when ); next = min( (*n)->start(), when );
} }
for ( ; f < next; f += beat_inc ) for ( ; f < next; f += frames_per_beat )
{ {
if ( ++bbt.beat == sig.beats_per_bar ) if ( ++bbt.beat == sig.beats_per_bar )
{ {
@ -434,6 +437,9 @@ Timeline::solve_tempomap ( nframes_t when )
} }
/* FIXME: this this right? */
bbt.tick = ticks_per_beat - ( ( ( f - when ) * ticks_per_beat ) / frames_per_beat );
return bbt; return bbt;
} }