From d2b4eca65b15177489b4a1efba56a38cd1e22671 Mon Sep 17 00:00:00 2001 From: richardash1981 Date: Tue, 26 Aug 2014 21:51:28 +0000 Subject: [PATCH] Patch by Martyn Shaw to fix a crash when the output of the VST effect does not have exactly two channels - we can now have any reasonable number of outputs from the plugin. This has been crashing windows builds of Audacity. --- src/effects/VST/VSTEffect.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index 15ef8f128..ce71bc214 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -3073,8 +3073,9 @@ bool VSTEffect::ProcessStereo(int count, // so overlay them by shifting the remaining output samples. else if (delay > 0) { sampleCount oblock = block - delay; - memmove(outBufSegment[0], outBufSegment[0] + delay, SAMPLE_SIZE(floatSample) * oblock); - memmove(outBufSegment[1], outBufSegment[1] + delay, SAMPLE_SIZE(floatSample) * oblock); + for (int i = 0; i < mOutputs; i++) { + memmove(outBufSegment[i], outBufSegment[i] + delay, SAMPLE_SIZE(floatSample) * oblock); + } delay = 0; outBufferCursor += oblock; }