diff options
author | Chris Robinson <[email protected]> | 2016-08-25 03:42:43 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-08-25 03:49:57 -0700 |
commit | 0fbf34fb4592aa29fcbf4e725719cb253e7d3a78 (patch) | |
tree | b378b50a61dd604bb7d2baadb127834c4c55e678 /Alc/effects/dedicated.c | |
parent | d8e9b3c621762e3d9e2b81034e19aa0d671247ae (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/dedicated.c')
-rw-r--r-- | Alc/effects/dedicated.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 98dd560b..818cbb6b 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -35,6 +35,25 @@ typedef struct ALdedicatedState { ALfloat gains[MAX_OUTPUT_CHANNELS]; } ALdedicatedState; +static ALvoid ALdedicatedState_Destruct(ALdedicatedState *state); +static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *state, ALCdevice *device); +static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice *device, const ALeffectslot *Slot, const ALeffectProps *props); +static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +DECLARE_DEFAULT_ALLOCATORS(ALdedicatedState) + +DEFINE_ALEFFECTSTATE_VTABLE(ALdedicatedState); + + +static void ALdedicatedState_Construct(ALdedicatedState *state) +{ + ALsizei s; + + ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); + SET_VTABLE2(ALdedicatedState, ALeffectState, state); + + for(s = 0;s < MAX_OUTPUT_CHANNELS;s++) + state->gains[s] = 0.0f; +} static ALvoid ALdedicatedState_Destruct(ALdedicatedState *state) { @@ -103,10 +122,6 @@ static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesTo } } -DECLARE_DEFAULT_ALLOCATORS(ALdedicatedState) - -DEFINE_ALEFFECTSTATE_VTABLE(ALdedicatedState); - typedef struct ALdedicatedStateFactory { DERIVE_FROM_TYPE(ALeffectStateFactory); @@ -115,14 +130,9 @@ typedef struct ALdedicatedStateFactory { ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(factory)) { ALdedicatedState *state; - ALsizei s; - state = ALdedicatedState_New(sizeof(*state)); + NEW_OBJ0(state, ALdedicatedState)(); if(!state) return NULL; - SET_VTABLE2(ALdedicatedState, ALeffectState, state); - - for(s = 0;s < MAX_OUTPUT_CHANNELS;s++) - state->gains[s] = 0.0f; return STATIC_CAST(ALeffectState, state); } |