From d65bc2a7985f7a4473206f4cf480e09c97c05c5f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 8 Aug 2022 09:08:48 -0600 Subject: [PATCH] triggerbox: fix lack of alignment after a locate. Triggerboxen were being executed during the latency preroll phase, which is inappropriate. ::fast_forward() will prepare them to run at precisely the correct time. So we add an explicit clause to avoid this. --- libs/ardour/route.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 1534385d7e..ae109032f4 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -537,10 +537,21 @@ Route::process_output_buffers (BufferSet& bufs, } } - if (speed < 0) { - (*i)->run (bufs, start_sample + latency, end_sample + latency, pspeed, nframes, *i != _processors.back()); - } else { - (*i)->run (bufs, start_sample - latency, end_sample - latency, pspeed, nframes, *i != _processors.back()); + /* run_disk_reader being false means we are still inside + * latency_preroll, and during this time we do not want to run + * the triggerbox at all. The disk reader looks at the speed + * (pspeed) that was reset to zero as a indication of how it + * should behave. The triggerbox is not speed-sensitive in the + * same way, so we need a more explicit test here to avoid + * running it. + */ + + if (run_disk_reader || ((*i) != _triggerbox)) { + if (speed < 0) { + (*i)->run (bufs, start_sample + latency, end_sample + latency, pspeed, nframes, *i != _processors.back()); + } else { + (*i)->run (bufs, start_sample - latency, end_sample - latency, pspeed, nframes, *i != _processors.back()); + } } bufs.set_count ((*i)->output_streams());