aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-05-26 18:08:57 -0700
committerChris Robinson <[email protected]>2020-05-26 18:08:57 -0700
commitf1612ce228965188618a435086d58dec8b4103f8 (patch)
treea45c8cfdf47204dc5771c9b3e23e3d06bc2ea991
parent9b63e2460cf0bda3b529b5500bdcb293c07b514f (diff)
Use dual-biquad processing for the equalizer effect
-rw-r--r--alc/effects/equalizer.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp
index 3005f2f7..8f002f8c 100644
--- a/alc/effects/equalizer.cpp
+++ b/alc/effects/equalizer.cpp
@@ -155,17 +155,15 @@ void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot,
void EqualizerState::process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut)
{
const al::span<float> buffer{mSampleBuffer.data(), samplesToDo};
- auto chandata = std::addressof(mChans[0]);
+ auto chan = std::addressof(mChans[0]);
for(const auto &input : samplesIn)
{
- chandata->filter[0].process({input.data(), samplesToDo}, buffer.begin());
- chandata->filter[1].process(buffer, buffer.begin());
- chandata->filter[2].process(buffer, buffer.begin());
- chandata->filter[3].process(buffer, buffer.begin());
-
- MixSamples(buffer, samplesOut, chandata->CurrentGains, chandata->TargetGains, samplesToDo,
- 0u);
- ++chandata;
+ const al::span<const float> inbuf{input.data(), samplesToDo};
+ DualBiquad{chan->filter[0], chan->filter[1]}.process(inbuf, buffer.begin());
+ DualBiquad{chan->filter[2], chan->filter[3]}.process(buffer, buffer.begin());
+
+ MixSamples(buffer, samplesOut, chan->CurrentGains, chan->TargetGains, samplesToDo, 0u);
+ ++chan;
}
}