diff options
author | Chris Robinson <[email protected]> | 2022-05-24 05:22:49 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-05-24 05:22:49 -0700 |
commit | 233863cf2966c1c4ecd9398031497597b544a1f7 (patch) | |
tree | 8912061f7be5c732388c509c375ca04b8f5d140c | |
parent | 6027ac4bc247bb2b7b963561edfce0fce9c0e3a1 (diff) |
Use a boolean check instead of a function pointer
-rw-r--r-- | alc/effects/reverb.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
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<ReverbUpdateLine,NUM_LINES> mEarlySamples{}; alignas(16) std::array<ReverbUpdateLine,NUM_LINES> mLateSamples{}; - using MixOutT = void (ReverbState::*)(const al::span<FloatBufferLine> samplesOut, - const size_t counter, const size_t offset, const size_t todo); - MixOutT mMixOut{&ReverbState::MixOutPlain}; + bool mUpmixOutput{false}; std::array<float,MaxAmbiOrder+1> mOrderScales{}; std::array<std::array<BandSplitter,NUM_LINES>,2> mAmbiSplitter; @@ -535,6 +533,15 @@ struct ReverbState final : public EffectState { } } + void mixOut(const al::span<FloatBufferLine> 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<const FloatBu lateUnfaded(offset, todo); /* Finally, mix early reflections and late reverb. */ - (this->*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<const FloatBu earlyFaded(offset, todo, fadeCount, fadeStep); lateFaded(offset, todo, fadeCount, fadeStep); - (this->*mMixOut)(samplesOut, samplesToDo-base, base, todo); + mixOut(samplesOut, samplesToDo-base, base, todo); offset += todo; base += todo; |