From 2c769e9f23f7cbf38100a6c972c37b0c2409d84b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 4 Mar 2022 19:41:25 +0100 Subject: [PATCH] Fix Beats::rount_to.. Bar rounding --- libs/temporal/beats.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/temporal/beats.cc b/libs/temporal/beats.cc index 9699c94916..b8d2ddfc77 100644 --- a/libs/temporal/beats.cc +++ b/libs/temporal/beats.cc @@ -46,8 +46,14 @@ Beats::round_to_subdivision (int subdivision, RoundMode dir) const { BBT_Time bbt (metric.bbt_at (*this)); if (dir < 0) { + if (dir == RoundDownAlways && bbt.ticks == 0) { + bbt = metric.bbt_subtract (bbt, Temporal::BBT_Offset (0, 0, 1)); + } bbt = metric.meter().round_down_to_bar (bbt); } if (dir > 0) { + if (dir == RoundUpAlways && bbt.ticks == 0) { + bbt.ticks += 1; + } bbt = metric.meter().round_up_to_bar (bbt); } else { bbt = metric.meter().round_to_bar (bbt);