libtemporal: add and use TempoMap::superclocks_per_grid_at() to return superclock duration of a measure/bar division. This corrects the results of ::get_grid()

This commit is contained in:
Paul Davis
2021-01-06 10:07:25 -07:00
parent 7f19f13ea9
commit a9bf1cff81
2 changed files with 5 additions and 1 deletions

View File

@@ -1825,7 +1825,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
if (bar_mod == 0) {
step = metric.superclocks_per_note_type_at_superclock (start);
step = metric.superclocks_per_grid_at (start);
start += step;
DEBUG_TRACE (DEBUG::Grid, string_compose ("step for note type was %1, now @ %2\n", step, start));

View File

@@ -485,6 +485,10 @@ class LIBTEMPORAL_API TempoMetric {
return _tempo->superclocks_per_note_type() * exp (-_tempo->omega() * (sc - _tempo->sclock()));
}
superclock_t superclocks_per_grid_at (superclock_t sc) const {
return int_div_round (superclocks_per_note_type_at_superclock (sc) * _tempo->note_type(), (int64_t) _meter->note_value());
}
BBT_Time bbt_at (superclock_t sc) const;
superclock_t superclock_at (BBT_Time const &) const;