From 186c4f6b537cd4cca7221d6f247190099411a27d Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Mon, 10 Feb 2020 21:28:31 +0100 Subject: [PATCH] Changed the width/position process again --- src/sfizz/Voice.cpp | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index fbe2674e..636fd5ba 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -350,40 +350,11 @@ void sfz::Voice::processStereo(AudioSpan buffer) noexcept egEnvelope.getBlock(modulationSpan); buffer.applyGain(modulationSpan); - // Create mid/side from left/right in the output buffer - // Add const aliases to be slightly more readable - const auto leftBufferCopy = tempSpan2.first(numSamples); - copy(leftBuffer, leftBufferCopy); - - const auto midBuffer = leftBuffer; - add(rightBuffer, midBuffer); - - const auto sideBuffer = rightBuffer; - applyGain(-1.0f, sideBuffer); - add(leftBufferCopy, sideBuffer); - - applyGain(sqrtTwoInv, midBuffer); - applyGain(sqrtTwoInv, sideBuffer); - - // Apply the width process + // Apply the width/position process widthEnvelope.getBlock(modulationSpan); - width(modulationSpan, midBuffer, sideBuffer); - - // Copy the mid channel into another span - const auto midBufferCopy = tempSpan3.first(numSamples); - copy(midBuffer, midBufferCopy); + width(modulationSpan, leftBuffer, rightBuffer); positionEnvelope.getBlock(modulationSpan); - pan(modulationSpan, midBuffer, midBufferCopy); - - // Rebuild left/right - // Recall that midBuffer and leftBuffer point to the same buffer - add(sideBuffer, leftBuffer); - applyGain(sqrtTwoInv, leftBuffer); - - // Recall that sideBuffer and rightBuffer point to the same buffer - applyGain(-1.0f, sideBuffer); - add(midBufferCopy, sideBuffer); - applyGain(sqrtTwoInv, rightBuffer); + pan(modulationSpan, leftBuffer, rightBuffer); // Filtering and EQ const float* inputChannels[2] { leftBuffer.data(), rightBuffer.data() };