diff options
author | Chris Robinson <[email protected]> | 2014-05-18 05:02:34 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-05-18 06:23:20 -0700 |
commit | a5631e05cc0273289cd5e2e86e554c9559cf2016 (patch) | |
tree | 46041845a14529fedfbce8ee7851f3a24c80d2f9 /Alc | |
parent | cd53a4b74c8bb2b1f8add3f95493f595cea548f9 (diff) |
Add a ALfilterState method to process multiple samples at once
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/mixer.c | 20 | ||||
-rw-r--r-- | Alc/mixer_c.c | 8 |
2 files changed, 19 insertions, 9 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index 32d4d308..8db0289e 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -96,20 +96,22 @@ static void DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter, break; case AF_LowPass: - for(i = 0;i < numsamples;i++) - dst[i] = ALfilterState_processSingle(lpfilter, src[i]); + ALfilterState_process(lpfilter, dst, src, numsamples); break; - case AF_HighPass: - for(i = 0;i < numsamples;i++) - dst[i] = ALfilterState_processSingle(hpfilter, src[i]); + ALfilterState_process(hpfilter, dst, src, numsamples); break; case AF_BandPass: - for(i = 0;i < numsamples;i++) - dst[i] = ALfilterState_processSingle(hpfilter, - ALfilterState_processSingle(lpfilter, src[i]) - ); + for(i = 0;i < numsamples;) + { + ALfloat temp[64]; + ALuint todo = minu(64, numsamples-i); + + ALfilterState_process(lpfilter, temp, src, todo); + ALfilterState_process(hpfilter, dst, temp, todo); + i += todo; + } break; } } diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index 2b8325ae..61769547 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -46,6 +46,14 @@ DECL_TEMPLATE(cubic32) #undef DECL_TEMPLATE +void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *src, ALuint numsamples) +{ + ALuint i; + for(i = 0;i < numsamples;i++) + *(dst++) = ALfilterState_processSingle(filter, *(src++)); +} + + static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], const ALuint IrSize, ALfloat (*restrict Coeffs)[2], |