const TempoSection* tempo;
const TempoSection* t;
double frames_per_beat;
+ framepos_t effective_pos = max (pos, (framepos_t) 0);
meter = &first_meter ();
tempo = &first_tempo ();
for (i = metrics.begin(); i != metrics.end(); ++i) {
- if ((*i)->frame() > pos) {
+ if ((*i)->frame() > effective_pos) {
break;
}
{
Glib::RWLock::ReaderLock lm (lock);
Metrics::const_iterator next_tempo;
- const TempoSection* tempo;
-
+ const TempoSection* tempo = 0;
+ framepos_t effective_pos = max (pos, (framepos_t) 0);
+
/* Find the relevant initial tempo metric */
for (next_tempo = metrics.begin(); next_tempo != metrics.end(); ++next_tempo) {
if ((t = dynamic_cast<const TempoSection*>(*next_tempo)) != 0) {
- if ((*next_tempo)->frame() > pos) {
+ if ((*next_tempo)->frame() > effective_pos) {
break;
}
next_tempo -> the next tempo after "pos", possibly metrics.end()
*/
+ assert (tempo);
+
Evoral::MusicalTime beats = 0;
while (distance) {
/* Update */
pos += sub;
distance -= sub;
+ assert (tempo);
beats += sub / tempo->frames_per_beat (_frame_rate);
/* Move on if there's anything to move to */
}
}
}
+ assert (tempo);
}
return beats;