13
0

tempo map: fix grid generation with ramped tempos

The old code used the instantaneous tempo at T0 to compute where the next
quarter note would be. This is incorrect, since the tempo is
changing (continuously, for now) during the time represented by that quarter
note. Instead, we need to add a quarter note (or technically, whatever the
tempo note type is) to get a new position in beats, then compute the superclock
time at that location (which will use our equations for tempo, including the
use of omega, the ramp factor).
This commit is contained in:
Paul Davis 2021-11-17 08:56:05 -07:00
parent 8972ed1517
commit 1ba2e28d6f

View File

@ -1947,11 +1947,10 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
if (bar_mod == 0) {
/* Advance by the meter note value size */
step = metric.superclocks_per_grid_at (start);
start += step;
bbt = metric.bbt_at (timepos_t::from_superclock (start));
DEBUG_TRACE (DEBUG::Grid, string_compose ("step for note type was %1, now @ %2\n", step, start));
beats += metric.tempo().note_type_as_beats ();
bbt = metric.bbt_at (beats);
start = metric.superclock_at (beats);
DEBUG_TRACE (DEBUG::Grid, string_compose ("step at %3 for note type was %1, now @ %2 beats = %4\n", step, start, bbt, beats));
} else {