From 4825d67c4ab8af7ec79cb74fe0a8fa441688a0bf Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 20 Jun 2022 21:13:52 +0200 Subject: [PATCH] Fix record w/count-in The pre-nutemo code used fmod() to calculate the offset into the bar: `bar_fract = fmod (barbeat, 1.0); // fraction of bar elapsed` with nutempo, beats start at 1, and the tick offset must also be taken into account. The bug was introduced in f67029bd0 --- libs/ardour/session_transport.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 990f8e12a2..e0cfee3203 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -553,7 +553,7 @@ Session::start_transport (bool after_loop) const double num = tempometric.divisions_per_bar (); /* XXX possible optimization: get meter and BBT time in one call */ const Temporal::BBT_Time bbt = tmap->bbt_at (timepos_t (_transport_sample)); - const double bar_fract = (double) bbt.beats / tempometric.divisions_per_bar(); + const double bar_fract = (bbt.beats - 1.0 + bbt.ticks / (double)Temporal::ticks_per_beat) / tempometric.divisions_per_bar(); _count_in_samples = tempometric.samples_per_bar (_current_sample_rate);