Changed the M/S processing to use the pan/width helpers
This commit is contained in:
parent
9783e393da
commit
06de588308
1 changed files with 17 additions and 22 deletions
|
|
@ -327,33 +327,28 @@ void sfz::Voice::processStereo(AudioSpan<float> buffer) noexcept
|
||||||
copy<float>(rightBuffer, span1);
|
copy<float>(rightBuffer, span1);
|
||||||
add<float>(leftBuffer, rightBuffer);
|
add<float>(leftBuffer, rightBuffer);
|
||||||
subtract<float>(span1, leftBuffer);
|
subtract<float>(span1, leftBuffer);
|
||||||
applyGain<float>(sqrtTwoInv<float>, leftBuffer);
|
|
||||||
applyGain<float>(sqrtTwoInv<float>, rightBuffer);
|
// Add const aliases to be slightly more readable
|
||||||
|
const auto midBuffer = leftBuffer;
|
||||||
|
const auto sideBuffer = rightBuffer;
|
||||||
|
applyGain<float>(sqrtTwoInv<float>, midBuffer);
|
||||||
|
applyGain<float>(sqrtTwoInv<float>, sideBuffer);
|
||||||
|
|
||||||
// Apply the width process
|
// Apply the width process
|
||||||
widthEnvelope.getBlock(span1);
|
widthEnvelope.getBlock(span1);
|
||||||
fill<float>(span2, 1.0f);
|
width<float>(span1, midBuffer, sideBuffer);
|
||||||
add<float>(span1, span2);
|
|
||||||
applyGain<float>(piFour<float>, span2);
|
|
||||||
cos<float>(span2, span1);
|
|
||||||
sin<float>(span2, span2);
|
|
||||||
applyGain<float>(span1, leftBuffer);
|
|
||||||
applyGain<float>(span2, rightBuffer);
|
|
||||||
|
|
||||||
// Apply a position to the "left" channel which is supposed to be our mid channel
|
// Copy the mid channel into another span
|
||||||
// TODO: add panning here too?
|
const auto midBufferRight = span2;
|
||||||
|
copy<float>(midBuffer, midBufferRight);
|
||||||
positionEnvelope.getBlock(span1);
|
positionEnvelope.getBlock(span1);
|
||||||
fill<float>(span2, 1.0f);
|
pan<float>(span1, midBuffer, midBufferRight);
|
||||||
add<float>(span1, span2);
|
|
||||||
applyGain<float>(piFour<float>, span2);
|
// Rebuild left/right
|
||||||
cos<float>(span2, span1);
|
add<float>(sideBuffer, midBuffer);
|
||||||
sin<float>(span2, span2);
|
applyGain(sqrtTwoInv<float>, leftBuffer);
|
||||||
copy<float>(leftBuffer, span3);
|
add<float>(midBufferRight, sideBuffer);
|
||||||
copy<float>(rightBuffer, leftBuffer);
|
applyGain(sqrtTwoInv<float>, rightBuffer);
|
||||||
multiplyAdd<float>(span1, span3, leftBuffer);
|
|
||||||
multiplyAdd<float>(span2, span3, rightBuffer);
|
|
||||||
applyGain<float>(sqrtTwoInv<float>, leftBuffer);
|
|
||||||
applyGain<float>(sqrtTwoInv<float>, rightBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue