Fix the unison osc broken after alignment work

This commit is contained in:
Jean Pierre Cimalando 2020-09-23 14:02:29 +02:00
parent 2b2a373b13
commit f3fbc1e327

View file

@ -693,8 +693,9 @@ void sfz::Voice::fillWithGenerator(AudioSpan<float> buffer) noexcept
else if (oscillatorMode <= 0 && oscillatorMulti >= 3) { else if (oscillatorMode <= 0 && oscillatorMulti >= 3) {
// unison oscillator // unison oscillator
auto tempSpan = resources.bufferPool.getBuffer(numFrames); auto tempSpan = resources.bufferPool.getBuffer(numFrames);
auto temp2Span = resources.bufferPool.getBuffer(numFrames); auto tempLeftSpan = resources.bufferPool.getBuffer(numFrames);
if (!tempSpan || !temp2Span) auto tempRightSpan = resources.bufferPool.getBuffer(numFrames);
if (!tempSpan || !tempLeftSpan || !tempRightSpan)
return; return;
const float* detuneMod = resources.modMatrix.getModulation(oscillatorDetuneTarget); const float* detuneMod = resources.modMatrix.getModulation(oscillatorDetuneTarget);
@ -708,11 +709,18 @@ void sfz::Voice::fillWithGenerator(AudioSpan<float> buffer) noexcept
applyGain1(waveDetuneRatio[u], *detuneSpan); applyGain1(waveDetuneRatio[u], *detuneSpan);
} }
osc.processModulated(frequencies->data(), detuneSpan->data(), tempSpan->data(), numFrames); osc.processModulated(frequencies->data(), detuneSpan->data(), tempSpan->data(), numFrames);
multiplyAdd1<float>(waveLeftGain[u], *tempSpan, *temp2Span); if (u == 0) {
copy<float>(*temp2Span, leftSpan); applyGain1<float>(waveLeftGain[u], *tempSpan, *tempLeftSpan);
multiplyAdd1<float>(waveRightGain[u], *tempSpan, *temp2Span); applyGain1<float>(waveRightGain[u], *tempSpan, *tempRightSpan);
copy<float>(*temp2Span, rightSpan); }
else {
multiplyAdd1<float>(waveLeftGain[u], *tempSpan, *tempLeftSpan);
multiplyAdd1<float>(waveRightGain[u], *tempSpan, *tempRightSpan);
}
} }
copy<float>(*tempLeftSpan, leftSpan);
copy<float>(*tempRightSpan, rightSpan);
} }
else { else {
// modulated oscillator // modulated oscillator