13
0

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.
This commit is contained in:
Paul Davis 2022-01-31 15:55:53 -07:00
parent 6ca8326c6a
commit ca6c99586f

View File

@ -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));