diff options
author | Chris Robinson <[email protected]> | 2019-08-26 09:16:20 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-08-26 09:16:20 -0700 |
commit | 7dbf69afa270417c28605a265cc2ec0a7c4fc939 (patch) | |
tree | ff6af7e2f556ecace074ef1ee968f088b5de2094 /alc/effects/equalizer.cpp | |
parent | 12e6dc0cced98d8d4379dbdaa922381920d32df2 (diff) |
Use a span for effect state input
Diffstat (limited to 'alc/effects/equalizer.cpp')
-rw-r--r-- | alc/effects/equalizer.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
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<FloatBufferLine> samplesOut) override; + void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> 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<FloatBufferLine> samplesOut) +void EqualizerState::process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> 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; } } |