diff options
author | Chris Robinson <[email protected]> | 2020-04-23 22:13:52 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-23 22:13:52 -0700 |
commit | 873983377052594b418bfa6cd505df7c604792ea (patch) | |
tree | 8b500bb483a079107dfd9feb368e8751f14ce44e /alc/voice.cpp | |
parent | e89978195f3910693958b8faebbd88b4643f8d57 (diff) |
Add a method to process two biquads at once
Diffstat (limited to 'alc/voice.cpp')
-rw-r--r-- | alc/voice.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/alc/voice.cpp b/alc/voice.cpp index 47e8f145..5dce9541 100644 --- a/alc/voice.cpp +++ b/alc/voice.cpp @@ -309,28 +309,27 @@ void SendSourceStoppedEvent(ALCcontext *context, ALuint id) } -const float *DoFilters(BiquadFilter *lpfilter, BiquadFilter *hpfilter, float *dst, +const float *DoFilters(BiquadFilter &lpfilter, BiquadFilter &hpfilter, float *dst, const al::span<const float> src, int type) { switch(type) { case AF_None: - lpfilter->clear(); - hpfilter->clear(); + lpfilter.clear(); + hpfilter.clear(); break; case AF_LowPass: - lpfilter->process(src, dst); - hpfilter->clear(); + lpfilter.process(src, dst); + hpfilter.clear(); return dst; case AF_HighPass: - lpfilter->clear(); - hpfilter->process(src, dst); + lpfilter.clear(); + hpfilter.process(src, dst); return dst; case AF_BandPass: - lpfilter->process(src, dst); - hpfilter->process({dst, src.size()}, dst); + DualBiquad{lpfilter, hpfilter}.process(src, dst); return dst; } return src.data(); @@ -765,7 +764,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesToD float (&FilterBuf)[BUFFERSIZE] = Device->FilteredData; { DirectParams &parms = chandata.mDryParams; - const float *samples{DoFilters(&parms.LowPass, &parms.HighPass, FilterBuf, + const float *samples{DoFilters(parms.LowPass, parms.HighPass, FilterBuf, {ResampledData, DstBufferSize}, mDirect.FilterType)}; if((mFlags&VOICE_HAS_HRTF)) @@ -797,7 +796,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesToD continue; SendParams &parms = chandata.mWetParams[send]; - const float *samples{DoFilters(&parms.LowPass, &parms.HighPass, FilterBuf, + const float *samples{DoFilters(parms.LowPass, parms.HighPass, FilterBuf, {ResampledData, DstBufferSize}, mSend[send].FilterType)}; const float *TargetGains{UNLIKELY(vstate == Stopping) ? SilentTarget.data() |