diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 4510923b..e9f2e35f 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -454,10 +454,8 @@ struct ReverbState final : public EffectState { alignas(16) std::array mEarlySamples{}; alignas(16) std::array mLateSamples{}; - using MixOutT = void (ReverbState::*)(const al::span samplesOut, - const size_t counter, const size_t offset, const size_t todo); - MixOutT mMixOut{&ReverbState::MixOutPlain}; + bool mUpmixOutput{false}; std::array mOrderScales{}; std::array,2> mAmbiSplitter; @@ -535,6 +533,15 @@ struct ReverbState final : public EffectState { } } + void mixOut(const al::span samplesOut, const size_t counter, + const size_t offset, const size_t todo) + { + if(mUpmixOutput) + MixOutAmbiUp(samplesOut, counter, offset, todo); + else + MixOutPlain(samplesOut, counter, offset, todo); + } + void allocLines(const float frequency); void updateDelayLine(const float earlyDelay, const float lateDelay, const float density_mult, @@ -688,12 +695,12 @@ void ReverbState::deviceUpdate(const DeviceBase *device, const Buffer&) if(device->mAmbiOrder > 1) { - mMixOut = &ReverbState::MixOutAmbiUp; + mUpmixOutput = true; mOrderScales = AmbiScale::GetHFOrderScales(1, device->mAmbiOrder); } else { - mMixOut = &ReverbState::MixOutPlain; + mUpmixOutput = false; mOrderScales.fill(1.0f); } mAmbiSplitter[0][0].init(device->mXOverFreq / frequency); @@ -1650,7 +1657,7 @@ void ReverbState::process(const size_t samplesToDo, const al::span*mMixOut)(samplesOut, samplesToDo-base, base, todo); + mixOut(samplesOut, samplesToDo-base, base, todo); offset += todo; base += todo; @@ -1670,7 +1677,7 @@ void ReverbState::process(const size_t samplesToDo, const al::span*mMixOut)(samplesOut, samplesToDo-base, base, todo); + mixOut(samplesOut, samplesToDo-base, base, todo); offset += todo; base += todo;