From 51c95b412f55b87f130da186b09c03e5254f0030 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Fri, 7 Jan 2022 13:50:08 +0000 Subject: [PATCH] Fix wet/dry mix when performing in-place processing (output buffer == input buffer). Previously the plugin was effectively INPLACE_BROKEN but did not declare it. I never noticed this before because all the LADSPA hosts I tested in used out-of-place buffers --- ladspa-lv2/RubberBandPitchShifter.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ladspa-lv2/RubberBandPitchShifter.cpp b/ladspa-lv2/RubberBandPitchShifter.cpp index f9c5fd5..3c9ce7e 100644 --- a/ladspa-lv2/RubberBandPitchShifter.cpp +++ b/ladspa-lv2/RubberBandPitchShifter.cpp @@ -554,6 +554,10 @@ RubberBandPitchShifter::updateFormant() void RubberBandPitchShifter::runImpl(uint32_t insamples) { + for (size_t c = 0; c < m_channels; ++c) { + m_delayMixBuffer[c]->write(m_input[c], insamples); + } + size_t offset = 0; // We have to break up the input into chunks like this because @@ -572,11 +576,9 @@ RubberBandPitchShifter::runImpl(uint32_t insamples) offset += block; } - for (size_t c = 0; c < m_channels; ++c) { - m_delayMixBuffer[c]->write(m_input[c], insamples); - } float mix = 0.0; if (m_wetDry) mix = *m_wetDry; + for (size_t c = 0; c < m_channels; ++c) { if (mix > 0.0) { for (size_t i = 0; i < insamples; ++i) {