Fix grid when tempo marker is not on a mod_bar/beat_div

Previously the current iterator bbt was moved to p->bbt().

From then on, no grid line is reached if the point p is not on
a bar and mod_bar != 0 or the point is not on an expected beat_div.

e.g. when using bbt += mod_bar, and a tempo-change is at 5|2|0.
iterations continues 6|2|0 7|2|0  is_bar() is always false
and no more grid-lines were added.

Rather than trying
   bbt = round-up-to-next-grid-mod-div
and then finding the metric for that position, this
approach only does the latter using the already incremented
BBT position.
This commit is contained in:
Robin Gareus 2023-01-11 00:25:07 +01:00
parent b0a679a1af
commit 34e12a5d78
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -2107,11 +2107,14 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
if (reset) {
/* reset our sense of "now" to be wherever the point is */
/* bbt is position for the next grid-line.
* It is already increameted above depending on mod_bar and beat_div
* and must not be changed here.
*
* Skip metrics until p->bbt() is at or after up to next grid mod div.
*/
start = p->sclock();
bbt = p->bbt();
beats = p->beats();
assert (p->bbt() <= bbt);
/* If we just arrived at a point (indicated by bbt ==
* p->bbt()), use all points at the same location to
@ -2122,7 +2125,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
bool rebuild_metric = false;
while (p->bbt() == bbt) {
while (p != _points.end() && p->bbt() <= bbt) {
TempoPoint const * tpp;
MeterPoint const * mpp;
@ -2147,6 +2150,8 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
DEBUG_TRACE (DEBUG::Grid, string_compose ("second| with start = %1 aka %2 rebuilt metric from points, now %3\n", start, bbt, metric));
}
/* this is potentially ambiguous */
start = metric.superclock_at (bbt);
}
/* Update the quarter-note time value to match the BBT and