From 7dbf69afa270417c28605a265cc2ec0a7c4fc939 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 26 Aug 2019 09:16:20 -0700 Subject: Use a span for effect state input --- alc/effects/equalizer.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'alc/effects/equalizer.cpp') diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp index 05818ebf..929bff14 100644 --- a/alc/effects/equalizer.cpp +++ b/alc/effects/equalizer.cpp @@ -93,7 +93,7 @@ struct EqualizerState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(const size_t samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span samplesOut) override; + void process(const size_t samplesToDo, const al::span samplesIn, const al::span samplesOut) override; DEF_NEWDEL(EqualizerState) }; @@ -157,18 +157,19 @@ void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot, } } -void EqualizerState::process(const size_t samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span samplesOut) +void EqualizerState::process(const size_t samplesToDo, const al::span samplesIn, const al::span samplesOut) { - ASSUME(numInput > 0); - for(ALsizei c{0};c < numInput;c++) + auto chandata = std::addressof(mChans[0]); + for(const auto &input : samplesIn) { - mChans[c].filter[0].process(mSampleBuffer, samplesIn[c].data(), samplesToDo); - mChans[c].filter[1].process(mSampleBuffer, mSampleBuffer, samplesToDo); - mChans[c].filter[2].process(mSampleBuffer, mSampleBuffer, samplesToDo); - mChans[c].filter[3].process(mSampleBuffer, mSampleBuffer, samplesToDo); - - MixSamples({mSampleBuffer, samplesToDo}, samplesOut, mChans[c].CurrentGains, - mChans[c].TargetGains, samplesToDo, 0); + chandata->filter[0].process(mSampleBuffer, input.data(), samplesToDo); + chandata->filter[1].process(mSampleBuffer, mSampleBuffer, samplesToDo); + chandata->filter[2].process(mSampleBuffer, mSampleBuffer, samplesToDo); + chandata->filter[3].process(mSampleBuffer, mSampleBuffer, samplesToDo); + + MixSamples({mSampleBuffer, samplesToDo}, samplesOut, chandata->CurrentGains, + chandata->TargetGains, samplesToDo, 0); + ++chandata; } } -- cgit v1.2.3