Browse Source

Include tick ibn BBT info.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
6dd66f328f
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      Timeline/Timeline.C

+ 9
- 3
Timeline/Timeline.C 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;
} }




Loading…
Cancel
Save