aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/equalizer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-08-25 03:42:43 -0700
committerChris Robinson <[email protected]>2016-08-25 03:49:57 -0700
commit0fbf34fb4592aa29fcbf4e725719cb253e7d3a78 (patch)
treeb378b50a61dd604bb7d2baadb127834c4c55e678 /Alc/effects/equalizer.c
parentd8e9b3c621762e3d9e2b81034e19aa0d671247ae (diff)
Add a ref count to ALeffectState
This is mostly just reorganizing the effects to call the Construct method which initializes the ref count.
Diffstat (limited to 'Alc/effects/equalizer.c')
-rw-r--r--Alc/effects/equalizer.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index 96676d34..2b59cb37 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -87,6 +87,31 @@ typedef struct ALequalizerState {
ALfloat SampleBuffer[4][MAX_EFFECT_CHANNELS][MAX_UPDATE_SAMPLES];
} ALequalizerState;
+static ALvoid ALequalizerState_Destruct(ALequalizerState *state);
+static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *state, ALCdevice *device);
+static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props);
+static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels);
+DECLARE_DEFAULT_ALLOCATORS(ALequalizerState)
+
+DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState);
+
+
+static void ALequalizerState_Construct(ALequalizerState *state)
+{
+ int it, ft;
+
+ ALeffectState_Construct(STATIC_CAST(ALeffectState, state));
+ SET_VTABLE2(ALequalizerState, ALeffectState, state);
+
+ /* Initialize sample history only on filter creation to avoid */
+ /* sound clicks if filter settings were changed in runtime. */
+ for(it = 0; it < 4; it++)
+ {
+ for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++)
+ ALfilterState_clear(&state->filter[it][ft]);
+ }
+}
+
static ALvoid ALequalizerState_Destruct(ALequalizerState *state)
{
ALeffectState_Destruct(STATIC_CAST(ALeffectState,state));
@@ -223,10 +248,6 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesTo
}
}
-DECLARE_DEFAULT_ALLOCATORS(ALequalizerState)
-
-DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState);
-
typedef struct ALequalizerStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
@@ -235,19 +256,9 @@ typedef struct ALequalizerStateFactory {
ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(factory))
{
ALequalizerState *state;
- int it, ft;
- state = ALequalizerState_New(sizeof(*state));
+ NEW_OBJ0(state, ALequalizerState)();
if(!state) return NULL;
- SET_VTABLE2(ALequalizerState, ALeffectState, state);
-
- /* Initialize sample history only on filter creation to avoid */
- /* sound clicks if filter settings were changed in runtime. */
- for(it = 0; it < 4; it++)
- {
- for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++)
- ALfilterState_clear(&state->filter[it][ft]);
- }
return STATIC_CAST(ALeffectState, state);
}