aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/echo.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/echo.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/echo.c')
-rw-r--r--Alc/effects/echo.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c
index 4d2fd6f4..3ad1e975 100644
--- a/Alc/effects/echo.c
+++ b/Alc/effects/echo.c
@@ -50,6 +50,30 @@ typedef struct ALechoState {
ALfilterState Filter;
} ALechoState;
+static ALvoid ALechoState_Destruct(ALechoState *state);
+static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device);
+static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props);
+static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels);
+DECLARE_DEFAULT_ALLOCATORS(ALechoState)
+
+DEFINE_ALEFFECTSTATE_VTABLE(ALechoState);
+
+
+static void ALechoState_Construct(ALechoState *state)
+{
+ ALeffectState_Construct(STATIC_CAST(ALeffectState, state));
+ SET_VTABLE2(ALechoState, ALeffectState, state);
+
+ state->BufferLength = 0;
+ state->SampleBuffer = NULL;
+
+ state->Tap[0].delay = 0;
+ state->Tap[1].delay = 0;
+ state->Offset = 0;
+
+ ALfilterState_clear(&state->Filter);
+}
+
static ALvoid ALechoState_Destruct(ALechoState *state)
{
al_free(state->SampleBuffer);
@@ -184,10 +208,6 @@ static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const
state->Offset = offset;
}
-DECLARE_DEFAULT_ALLOCATORS(ALechoState)
-
-DEFINE_ALEFFECTSTATE_VTABLE(ALechoState);
-
typedef struct ALechoStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
@@ -197,18 +217,8 @@ ALeffectState *ALechoStateFactory_create(ALechoStateFactory *UNUSED(factory))
{
ALechoState *state;
- state = ALechoState_New(sizeof(*state));
+ NEW_OBJ0(state, ALechoState)();
if(!state) return NULL;
- SET_VTABLE2(ALechoState, ALeffectState, state);
-
- state->BufferLength = 0;
- state->SampleBuffer = NULL;
-
- state->Tap[0].delay = 0;
- state->Tap[1].delay = 0;
- state->Offset = 0;
-
- ALfilterState_clear(&state->Filter);
return STATIC_CAST(ALeffectState, state);
}