aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/compressor.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/compressor.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/compressor.c')
-rw-r--r--Alc/effects/compressor.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c
index 6329d3f1..1426ea70 100644
--- a/Alc/effects/compressor.c
+++ b/Alc/effects/compressor.c
@@ -40,6 +40,26 @@ typedef struct ALcompressorState {
ALfloat GainCtrl;
} ALcompressorState;
+static ALvoid ALcompressorState_Destruct(ALcompressorState *state);
+static ALboolean ALcompressorState_deviceUpdate(ALcompressorState *state, ALCdevice *device);
+static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props);
+static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels);
+DECLARE_DEFAULT_ALLOCATORS(ALcompressorState)
+
+DEFINE_ALEFFECTSTATE_VTABLE(ALcompressorState);
+
+
+static void ALcompressorState_Construct(ALcompressorState *state)
+{
+ ALeffectState_Construct(STATIC_CAST(ALeffectState, state));
+ SET_VTABLE2(ALcompressorState, ALeffectState, state);
+
+ state->Enabled = AL_TRUE;
+ state->AttackRate = 0.0f;
+ state->ReleaseRate = 0.0f;
+ state->GainCtrl = 1.0f;
+}
+
static ALvoid ALcompressorState_Destruct(ALcompressorState *state)
{
ALeffectState_Destruct(STATIC_CAST(ALeffectState,state));
@@ -165,10 +185,6 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples
}
}
-DECLARE_DEFAULT_ALLOCATORS(ALcompressorState)
-
-DEFINE_ALEFFECTSTATE_VTABLE(ALcompressorState);
-
typedef struct ALcompressorStateFactory {
DERIVE_FROM_TYPE(ALeffectStateFactory);
@@ -178,14 +194,8 @@ static ALeffectState *ALcompressorStateFactory_create(ALcompressorStateFactory *
{
ALcompressorState *state;
- state = ALcompressorState_New(sizeof(*state));
+ NEW_OBJ0(state, ALcompressorState)();
if(!state) return NULL;
- SET_VTABLE2(ALcompressorState, ALeffectState, state);
-
- state->Enabled = AL_TRUE;
- state->AttackRate = 0.0f;
- state->ReleaseRate = 0.0f;
- state->GainCtrl = 1.0f;
return STATIC_CAST(ALeffectState, state);
}