Fixed a bug that causes invalid effect output

This commit is contained in:
KIRA Ryouta 2024-02-13 10:36:47 +09:00 committed by Paul Ferrand
parent 9d5f7bf4aa
commit cc33ed160f

View file

@ -1159,7 +1159,6 @@ void Synth::renderBlock(AudioSpan<float> buffer) noexcept
{ // Main render block { // Main render block
ScopedTiming logger { callbackBreakdown.renderMethod, ScopedTiming::Operation::addToDuration }; ScopedTiming logger { callbackBreakdown.renderMethod, ScopedTiming::Operation::addToDuration };
tempMixSpan->fill(0.0f);
for (auto& voice : impl.voiceManager_) { for (auto& voice : impl.voiceManager_) {
if (voice.isFree()) if (voice.isFree())
@ -1197,6 +1196,7 @@ void Synth::renderBlock(AudioSpan<float> buffer) noexcept
const int numChannels = static_cast<int>(buffer.getNumChannels()); const int numChannels = static_cast<int>(buffer.getNumChannels());
for (int i = 0; i < impl.numOutputs_; ++i) { for (int i = 0; i < impl.numOutputs_; ++i) {
tempMixSpan->fill(0.0f);
const auto outputStart = numChannels == 0 ? 0 : (2 * i) % numChannels; const auto outputStart = numChannels == 0 ? 0 : (2 * i) % numChannels;
auto outputSpan = buffer.getStereoSpan(outputStart); auto outputSpan = buffer.getStereoSpan(outputStart);
const auto& effectBuses = impl.getEffectBusesForOutput(i); const auto& effectBuses = impl.getEffectBusesForOutput(i);