fix BBT_Time::round_up_to_beat_div() (partially)

Math is now correct for cases where "beats" in BBT are quarters.
Incorrect for others
This commit is contained in:
Paul Davis 2023-09-22 22:54:37 -06:00
parent 44d32d6325
commit 14e7f62891
1 changed files with 4 additions and 4 deletions

View File

@ -64,9 +64,9 @@ BBT_Time::round_up_to_beat_div (int beat_div) const
an integer beat position (think triplets.
*/
int32_t div_ticks = ticks_per_beat / beat_div;
int32_t ticks_remainder = ticks % div_ticks;
int32_t rounded_up = ticks + div_ticks - ticks_remainder;
const int32_t div_ticks = ticks_per_beat / beat_div;
int32_t rounded_up = ticks + div_ticks - 1;
rounded_up -= rounded_up % div_ticks;
if (rounded_up == ticks_per_beat) {
return BBT_Time (bars, beats+1, 0);