diff --git a/tests/DemoStereo.cpp b/tests/DemoStereo.cpp index 0c6f47ee..2ef1558c 100644 --- a/tests/DemoStereo.cpp +++ b/tests/DemoStereo.cpp @@ -160,42 +160,8 @@ int DemoApp::processAudio(jack_nframes_t nframes, void *cbdata) std::fill(positionEnvelope.begin(), positionEnvelope.end(), self->fPan * 0.01f); using namespace sfz; - - /* TODO(jpc) have this code in common instead of copy-paste */ - - // Create mid/side from left/right in the output buffer - // Add const aliases to be slightly more readable - const auto leftBufferCopy = tempSpan1; - 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 - width(widthEnvelope, midBuffer, sideBuffer); - - // Copy the mid channel into another span - const auto midBufferCopy = tempSpan1; - copy(midBuffer, midBufferCopy); - pan(positionEnvelope, 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); - + width(widthEnvelope, leftBuffer, rightBuffer); + pan(positionEnvelope, leftBuffer, rightBuffer); return 0; }