temporal: remove iterative bbt_delta() since unit test shows breakage

This commit is contained in:
Paul Davis 2025-08-22 10:51:16 -06:00 committed by Edgar Aichinger
parent d6e331fe6c
commit 3f45c0bdec

View file

@ -360,8 +360,6 @@ Meter::bbt_delta (BBT_Time const & later, BBT_Time const & earlier) const
assert (later > earlier);
#if 1 // more efficient than iterative method below
BBT_Offset d;
BBT_Time a (earlier);
BBT_Time b (later);
@ -388,54 +386,6 @@ Meter::bbt_delta (BBT_Time const & later, BBT_Time const & earlier) const
d.bars = b.bars - a.bars;
return d;
#else
BBT_Time a (earlier);
BBT_Time b (later);
int32_t d_bars = 0;
int32_t d_beats = 0;
int32_t d_ticks = 0;
/* Walk to next grid-beat, counting ticks (and wrapped beats and bars
* if necessary)
*/
while (a.ticks < b.ticks) {
if (a.ticks == ticks_per_grid()) {
a.ticks = 0; /* not necessary but here for consistency */
a.beats++;
d_beats++;
if (a.beats == _divisions_per_bar) {
a.beats = 1;
a.bars++;
d_bars++;
}
break;
}
a.ticks++;
d_ticks++;
}
/* Walk to next bar, counting beats (and bars
* if necessary)
*/
while (a.beats < b.beats) {
if (a.beats == _divisions_per_bar) {
a.beats = 1;
a.bars++;
d_bars++;
break;
}
a.beats++;
d_beats++;
}
/* count bars */
d_bars = b.bars - a.bars;
return BBT_Offset (d_bars, d_beats, d_ticks);
#endif
}
Temporal::Beats