From ca6c99586fb40eae66a7f9899ded3db18134130b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 31 Jan 2022 15:55:53 -0700 Subject: [PATCH] triggerbox: minor arithmetic fix to help with clicks at clip end process_index should not be compared/combined with expected_end_sample, since the former is a process-cycle count and the latter is a timeline position. --- libs/ardour/triggerbox.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index 5d35123a51..a4199ca50c 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -1532,9 +1532,11 @@ AudioTrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa if (transition_samples + retrieved > expected_end_sample) { /* final pull from stretched data into output buffers */ - from_stretcher = std::min ((samplecnt_t) from_stretcher, expected_end_sample - process_index); + from_stretcher = std::min ((samplecnt_t) from_stretcher, final_processed_sample - process_index); // cerr << "FS#2 from ees " << expected_end_sample << " - " << process_index << " = " << from_stretcher << endl; + fade_out = true; + DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 total retrieved data %2 exceeds theoretical size %3, truncate from_stretcher to %4\n", index(), retrieved, expected_end_sample - transition_samples, from_stretcher));