From a5631e05cc0273289cd5e2e86e554c9559cf2016 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 18 May 2014 05:02:34 -0700 Subject: Add a ALfilterState method to process multiple samples at once --- OpenAL32/Include/alFilter.h | 5 +++++ OpenAL32/alFilter.c | 2 ++ 2 files changed, 7 insertions(+) (limited to 'OpenAL32') diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index 0b3ab844..62b5fda8 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -36,7 +36,10 @@ typedef struct ALfilterState { ALfloat y[2]; /* History of two last output samples */ ALfloat a[3]; /* Transfer function coefficients "a" */ ALfloat b[3]; /* Transfer function coefficients "b" */ + + void (*process)(struct ALfilterState *self, ALfloat *restrict dst, const ALfloat *src, ALuint numsamples); } ALfilterState; +#define ALfilterState_process(a, ...) ((a)->process((a), __VA_ARGS__)) void ALfilterState_clear(ALfilterState *filter); void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat bandwidth); @@ -58,6 +61,8 @@ inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample return outsmp; } +void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *src, ALuint numsamples); + typedef struct ALfilter { // Filter type (AL_FILTER_NULL, ...) diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index ad204bfc..acfae8a6 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -412,6 +412,8 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g filter->a[2] /= filter->a[0]; filter->a[1] /= filter->a[0]; filter->a[0] /= filter->a[0]; + + filter->process = ALfilterState_processC; } -- cgit v1.2.3