diff options
author | Chris Robinson <[email protected]> | 2013-05-20 01:32:02 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-20 01:32:02 -0700 |
commit | 4c436b106d1a2b57e28fcaff0d5ec4a7abc6badc (patch) | |
tree | c1aff676a030f3581a28bfcb65a286c9910aaaa5 /Alc/alcFlanger.c | |
parent | 1c523df16044730986ec745170d724fa82015ea0 (diff) |
Use some macros to help with deriving types
Diffstat (limited to 'Alc/alcFlanger.c')
-rw-r--r-- | Alc/alcFlanger.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Alc/alcFlanger.c b/Alc/alcFlanger.c index d5764706..5b643a46 100644 --- a/Alc/alcFlanger.c +++ b/Alc/alcFlanger.c @@ -31,8 +31,7 @@ typedef struct ALflangerState { - // Must be first in all effects! - ALeffectState state; + DERIVE_FROM_TYPE(ALeffectState); ALfloat *SampleBufferLeft; ALfloat *SampleBufferRight; @@ -56,8 +55,7 @@ typedef struct ALflangerState { static ALvoid FlangerDestroy(ALeffectState *effect) { - ALflangerState *state = (ALflangerState*)effect; - + ALflangerState *state = GET_PARENT_TYPE(ALflangerState, ALeffectState, effect); if(state) { free(state->SampleBufferLeft); @@ -72,7 +70,7 @@ static ALvoid FlangerDestroy(ALeffectState *effect) static ALboolean FlangerDeviceUpdate(ALeffectState *effect, ALCdevice *Device) { - ALflangerState *state = (ALflangerState*)effect; + ALflangerState *state = GET_PARENT_TYPE(ALflangerState, ALeffectState, effect); ALuint maxlen; ALuint it; @@ -113,7 +111,7 @@ static ALboolean FlangerDeviceUpdate(ALeffectState *effect, ALCdevice *Device) static ALvoid FlangerUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { - ALflangerState *state = (ALflangerState*)effect; + ALflangerState *state = GET_PARENT_TYPE(ALflangerState, ALeffectState, effect); ALuint it; for (it = 0; it < MaxChannels; it++) @@ -173,7 +171,7 @@ static ALvoid FlangerUpdate(ALeffectState *effect, ALCdevice *Device, const ALef static ALvoid FlangerProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALflangerState *state = (ALflangerState*)effect; + ALflangerState *state = GET_PARENT_TYPE(ALflangerState, ALeffectState, effect); const ALuint mask = state->BufferLength-1; ALuint it; ALuint kt; @@ -257,17 +255,17 @@ ALeffectState *FlangerCreate(void) if(!state) return NULL; - state->state.Destroy = FlangerDestroy; - state->state.DeviceUpdate = FlangerDeviceUpdate; - state->state.Update = FlangerUpdate; - state->state.Process = FlangerProcess; + GET_DERIVED_TYPE(ALeffectState, state)->Destroy = FlangerDestroy; + GET_DERIVED_TYPE(ALeffectState, state)->DeviceUpdate = FlangerDeviceUpdate; + GET_DERIVED_TYPE(ALeffectState, state)->Update = FlangerUpdate; + GET_DERIVED_TYPE(ALeffectState, state)->Process = FlangerProcess; state->BufferLength = 0; state->SampleBufferLeft = NULL; state->SampleBufferRight = NULL; state->offset = 0; - return &state->state; + return GET_DERIVED_TYPE(ALeffectState, state); } void flanger_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) |