diff options
author | Chris Robinson <[email protected]> | 2013-05-21 02:30:11 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-21 02:30:11 -0700 |
commit | 44da54ec7f1826e3318202084e49a58a886a3f7b (patch) | |
tree | 519a4908b45472563d988b323187f9acec4169f6 | |
parent | b6da74b6e2eb6ad72179e07bb7d50da4c2c95390 (diff) |
Rename some inheritance macros
-rw-r--r-- | Alc/alcChorus.c | 18 | ||||
-rw-r--r-- | Alc/alcDedicated.c | 16 | ||||
-rw-r--r-- | Alc/alcDistortion.c | 18 | ||||
-rw-r--r-- | Alc/alcEcho.c | 18 | ||||
-rw-r--r-- | Alc/alcEqualizer.c | 18 | ||||
-rw-r--r-- | Alc/alcFlanger.c | 18 | ||||
-rw-r--r-- | Alc/alcModulator.c | 16 | ||||
-rw-r--r-- | Alc/alcReverb.c | 24 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 6 |
9 files changed, 76 insertions, 76 deletions
diff --git a/Alc/alcChorus.c b/Alc/alcChorus.c index 87e186e9..5f360d17 100644 --- a/Alc/alcChorus.c +++ b/Alc/alcChorus.c @@ -52,7 +52,7 @@ typedef struct ALchorusState { static ALvoid ChorusDestroy(ALeffectState *effect) { - ALchorusState *state = GET_PARENT_TYPE(ALchorusState, ALeffectState, effect); + ALchorusState *state = STATIC_UPCAST(ALchorusState, ALeffectState, effect); if(state) { free(state->SampleBufferLeft); @@ -67,7 +67,7 @@ static ALvoid ChorusDestroy(ALeffectState *effect) static ALboolean ChorusDeviceUpdate(ALeffectState *effect, ALCdevice *Device) { - ALchorusState *state = GET_PARENT_TYPE(ALchorusState, ALeffectState, effect); + ALchorusState *state = STATIC_UPCAST(ALchorusState, ALeffectState, effect); ALuint maxlen; ALuint it; @@ -100,7 +100,7 @@ static ALboolean ChorusDeviceUpdate(ALeffectState *effect, ALCdevice *Device) static ALvoid ChorusUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { - ALchorusState *state = GET_PARENT_TYPE(ALchorusState, ALeffectState, effect); + ALchorusState *state = STATIC_UPCAST(ALchorusState, ALeffectState, effect); ALfloat frequency = Device->Frequency; ALfloat rate; ALint phase; @@ -238,7 +238,7 @@ DECL_TEMPLATE(Sinusoid) static ALvoid ChorusProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALchorusState *state = GET_PARENT_TYPE(ALchorusState, ALeffectState, effect); + ALchorusState *state = STATIC_UPCAST(ALchorusState, ALeffectState, effect); if(state->waveform == AL_CHORUS_WAVEFORM_TRIANGLE) ProcessTriangle(state, SamplesToDo, SamplesIn, SamplesOut); @@ -254,17 +254,17 @@ ALeffectState *ChorusCreate(void) if(!state) return NULL; - GET_DERIVED_TYPE(ALeffectState, state)->Destroy = ChorusDestroy; - GET_DERIVED_TYPE(ALeffectState, state)->DeviceUpdate = ChorusDeviceUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Update = ChorusUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Process = ChorusProcess; + STATIC_CAST(ALeffectState, state)->Destroy = ChorusDestroy; + STATIC_CAST(ALeffectState, state)->DeviceUpdate = ChorusDeviceUpdate; + STATIC_CAST(ALeffectState, state)->Update = ChorusUpdate; + STATIC_CAST(ALeffectState, state)->Process = ChorusProcess; state->BufferLength = 0; state->SampleBufferLeft = NULL; state->SampleBufferRight = NULL; state->offset = 0; - return GET_DERIVED_TYPE(ALeffectState, state); + return STATIC_CAST(ALeffectState, state); } void chorus_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) diff --git a/Alc/alcDedicated.c b/Alc/alcDedicated.c index bb82bbcb..35de345f 100644 --- a/Alc/alcDedicated.c +++ b/Alc/alcDedicated.c @@ -38,7 +38,7 @@ typedef struct ALdedicatedState { static ALvoid DedicatedDestroy(ALeffectState *effect) { - ALdedicatedState *state = GET_PARENT_TYPE(ALdedicatedState, ALeffectState, effect); + ALdedicatedState *state = STATIC_UPCAST(ALdedicatedState, ALeffectState, effect); free(state); } @@ -51,7 +51,7 @@ static ALboolean DedicatedDeviceUpdate(ALeffectState *effect, ALCdevice *Device) static ALvoid DedicatedUpdate(ALeffectState *effect, ALCdevice *device, const ALeffectslot *Slot) { - ALdedicatedState *state = GET_PARENT_TYPE(ALdedicatedState, ALeffectState, effect); + ALdedicatedState *state = STATIC_UPCAST(ALdedicatedState, ALeffectState, effect); ALfloat Gain; ALsizei s; @@ -67,7 +67,7 @@ static ALvoid DedicatedUpdate(ALeffectState *effect, ALCdevice *device, const AL static ALvoid DedicatedProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALdedicatedState *state = GET_PARENT_TYPE(ALdedicatedState, ALeffectState, effect); + ALdedicatedState *state = STATIC_UPCAST(ALdedicatedState, ALeffectState, effect); const ALfloat *gains = state->gains; ALuint i, c; @@ -90,15 +90,15 @@ ALeffectState *DedicatedCreate(void) if(!state) return NULL; - GET_DERIVED_TYPE(ALeffectState, state)->Destroy = DedicatedDestroy; - GET_DERIVED_TYPE(ALeffectState, state)->DeviceUpdate = DedicatedDeviceUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Update = DedicatedUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Process = DedicatedProcess; + STATIC_CAST(ALeffectState, state)->Destroy = DedicatedDestroy; + STATIC_CAST(ALeffectState, state)->DeviceUpdate = DedicatedDeviceUpdate; + STATIC_CAST(ALeffectState, state)->Update = DedicatedUpdate; + STATIC_CAST(ALeffectState, state)->Process = DedicatedProcess; for(s = 0;s < MaxChannels;s++) state->gains[s] = 0.0f; - return GET_DERIVED_TYPE(ALeffectState, state); + return STATIC_CAST(ALeffectState, state); } void ded_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) diff --git a/Alc/alcDistortion.c b/Alc/alcDistortion.c index 315a7761..c431a2ca 100644 --- a/Alc/alcDistortion.c +++ b/Alc/alcDistortion.c @@ -62,13 +62,13 @@ typedef struct ALdistortionState { static ALvoid DistortionDestroy(ALeffectState *effect) { - ALdistortionState *state = GET_PARENT_TYPE(ALdistortionState, ALeffectState, effect); + ALdistortionState *state = STATIC_UPCAST(ALdistortionState, ALeffectState, effect); free(state); } static ALboolean DistortionDeviceUpdate(ALeffectState *effect, ALCdevice *Device) { - ALdistortionState *state = GET_PARENT_TYPE(ALdistortionState, ALeffectState, effect); + ALdistortionState *state = STATIC_UPCAST(ALdistortionState, ALeffectState, effect); state->frequency = (ALfloat)Device->Frequency; @@ -77,7 +77,7 @@ static ALboolean DistortionDeviceUpdate(ALeffectState *effect, ALCdevice *Device static ALvoid DistortionUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { - ALdistortionState *state = GET_PARENT_TYPE(ALdistortionState, ALeffectState, effect); + ALdistortionState *state = STATIC_UPCAST(ALdistortionState, ALeffectState, effect); ALfloat gain = sqrtf(1.0f / Device->NumChan) * Slot->Gain; ALuint it; ALfloat w0; @@ -130,7 +130,7 @@ static ALvoid DistortionUpdate(ALeffectState *effect, ALCdevice *Device, const A static ALvoid DistortionProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALdistortionState *state = GET_PARENT_TYPE(ALdistortionState, ALeffectState, effect); + ALdistortionState *state = STATIC_UPCAST(ALdistortionState, ALeffectState, effect); const ALfloat fc = state->edge_coeff; float oversample_buffer[64][4]; ALfloat tempsmp; @@ -239,10 +239,10 @@ ALeffectState *DistortionCreate(void) if(!state) return NULL; - GET_DERIVED_TYPE(ALeffectState, state)->Destroy = DistortionDestroy; - GET_DERIVED_TYPE(ALeffectState, state)->DeviceUpdate = DistortionDeviceUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Update = DistortionUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Process = DistortionProcess; + STATIC_CAST(ALeffectState, state)->Destroy = DistortionDestroy; + STATIC_CAST(ALeffectState, state)->DeviceUpdate = DistortionDeviceUpdate; + STATIC_CAST(ALeffectState, state)->Update = DistortionUpdate; + STATIC_CAST(ALeffectState, state)->Process = DistortionProcess; state->bandpass.type = BANDPASS; state->lowpass.type = LOWPASS; @@ -254,7 +254,7 @@ ALeffectState *DistortionCreate(void) state->lowpass.y[0] = 0.0f; state->lowpass.y[1] = 0.0f; - return GET_DERIVED_TYPE(ALeffectState, state); + return STATIC_CAST(ALeffectState, state); } void distortion_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c index 498ebbc7..297d6e76 100644 --- a/Alc/alcEcho.c +++ b/Alc/alcEcho.c @@ -53,7 +53,7 @@ typedef struct ALechoState { static ALvoid EchoDestroy(ALeffectState *effect) { - ALechoState *state = GET_PARENT_TYPE(ALechoState, ALeffectState, effect); + ALechoState *state = STATIC_UPCAST(ALechoState, ALeffectState, effect); if(state) { free(state->SampleBuffer); @@ -64,7 +64,7 @@ static ALvoid EchoDestroy(ALeffectState *effect) static ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device) { - ALechoState *state = GET_PARENT_TYPE(ALechoState, ALeffectState, effect); + ALechoState *state = STATIC_UPCAST(ALechoState, ALeffectState, effect); ALuint maxlen, i; // Use the next power of 2 for the buffer length, so the tap offsets can be @@ -91,7 +91,7 @@ static ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device) static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { - ALechoState *state = GET_PARENT_TYPE(ALechoState, ALeffectState, effect); + ALechoState *state = STATIC_UPCAST(ALechoState, ALeffectState, effect); ALuint frequency = Device->Frequency; ALfloat lrpan, cw, g, gain; ALfloat dirGain; @@ -127,7 +127,7 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffec static ALvoid EchoProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALechoState *state = GET_PARENT_TYPE(ALechoState, ALeffectState, effect); + ALechoState *state = STATIC_UPCAST(ALechoState, ALeffectState, effect); const ALuint mask = state->BufferLength-1; const ALuint tap1 = state->Tap[0].delay; const ALuint tap2 = state->Tap[1].delay; @@ -185,10 +185,10 @@ ALeffectState *EchoCreate(void) if(!state) return NULL; - GET_DERIVED_TYPE(ALeffectState, state)->Destroy = EchoDestroy; - GET_DERIVED_TYPE(ALeffectState, state)->DeviceUpdate = EchoDeviceUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Update = EchoUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Process = EchoProcess; + STATIC_CAST(ALeffectState, state)->Destroy = EchoDestroy; + STATIC_CAST(ALeffectState, state)->DeviceUpdate = EchoDeviceUpdate; + STATIC_CAST(ALeffectState, state)->Update = EchoUpdate; + STATIC_CAST(ALeffectState, state)->Process = EchoProcess; state->BufferLength = 0; state->SampleBuffer = NULL; @@ -201,7 +201,7 @@ ALeffectState *EchoCreate(void) state->iirFilter.history[0] = 0.0f; state->iirFilter.history[1] = 0.0f; - return GET_DERIVED_TYPE(ALeffectState, state); + return STATIC_CAST(ALeffectState, state); } void echo_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) diff --git a/Alc/alcEqualizer.c b/Alc/alcEqualizer.c index d4b4f855..62097cd5 100644 --- a/Alc/alcEqualizer.c +++ b/Alc/alcEqualizer.c @@ -97,13 +97,13 @@ typedef struct ALequalizerState { static ALvoid EqualizerDestroy(ALeffectState *effect) { - ALequalizerState *state = GET_PARENT_TYPE(ALequalizerState, ALeffectState, effect); + ALequalizerState *state = STATIC_UPCAST(ALequalizerState, ALeffectState, effect); free(state); } static ALboolean EqualizerDeviceUpdate(ALeffectState *effect, ALCdevice *Device) { - ALequalizerState *state = GET_PARENT_TYPE(ALequalizerState, ALeffectState, effect); + ALequalizerState *state = STATIC_UPCAST(ALequalizerState, ALeffectState, effect); state->frequency = (ALfloat)Device->Frequency; @@ -112,7 +112,7 @@ static ALboolean EqualizerDeviceUpdate(ALeffectState *effect, ALCdevice *Device) static ALvoid EqualizerUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { - ALequalizerState *state = GET_PARENT_TYPE(ALequalizerState, ALeffectState, effect); + ALequalizerState *state = STATIC_UPCAST(ALequalizerState, ALeffectState, effect); ALfloat gain = sqrtf(1.0f / Device->NumChan) * Slot->Gain; ALuint it; @@ -217,7 +217,7 @@ static ALvoid EqualizerUpdate(ALeffectState *effect, ALCdevice *Device, const AL static ALvoid EqualizerProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALequalizerState *state = GET_PARENT_TYPE(ALequalizerState, ALeffectState, effect); + ALequalizerState *state = STATIC_UPCAST(ALequalizerState, ALeffectState, effect); ALuint base; ALuint it; ALuint kt; @@ -276,10 +276,10 @@ ALeffectState *EqualizerCreate(void) if(!state) return NULL; - GET_DERIVED_TYPE(ALeffectState, state)->Destroy = EqualizerDestroy; - GET_DERIVED_TYPE(ALeffectState, state)->DeviceUpdate = EqualizerDeviceUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Update = EqualizerUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Process = EqualizerProcess; + STATIC_CAST(ALeffectState, state)->Destroy = EqualizerDestroy; + STATIC_CAST(ALeffectState, state)->DeviceUpdate = EqualizerDeviceUpdate; + STATIC_CAST(ALeffectState, state)->Update = EqualizerUpdate; + STATIC_CAST(ALeffectState, state)->Process = EqualizerProcess; state->bandfilter[0].type = LOW_SHELF; state->bandfilter[1].type = PEAKING; @@ -296,7 +296,7 @@ ALeffectState *EqualizerCreate(void) state->bandfilter[it].y[1] = 0.0f; } - return GET_DERIVED_TYPE(ALeffectState, state); + return STATIC_CAST(ALeffectState, state); } void equalizer_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) diff --git a/Alc/alcFlanger.c b/Alc/alcFlanger.c index 7409a4c1..7c753eb6 100644 --- a/Alc/alcFlanger.c +++ b/Alc/alcFlanger.c @@ -52,7 +52,7 @@ typedef struct ALflangerState { static ALvoid FlangerDestroy(ALeffectState *effect) { - ALflangerState *state = GET_PARENT_TYPE(ALflangerState, ALeffectState, effect); + ALflangerState *state = STATIC_UPCAST(ALflangerState, ALeffectState, effect); if(state) { free(state->SampleBufferLeft); @@ -67,7 +67,7 @@ static ALvoid FlangerDestroy(ALeffectState *effect) static ALboolean FlangerDeviceUpdate(ALeffectState *effect, ALCdevice *Device) { - ALflangerState *state = GET_PARENT_TYPE(ALflangerState, ALeffectState, effect); + ALflangerState *state = STATIC_UPCAST(ALflangerState, ALeffectState, effect); ALuint maxlen; ALuint it; @@ -100,7 +100,7 @@ static ALboolean FlangerDeviceUpdate(ALeffectState *effect, ALCdevice *Device) static ALvoid FlangerUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { - ALflangerState *state = GET_PARENT_TYPE(ALflangerState, ALeffectState, effect); + ALflangerState *state = STATIC_UPCAST(ALflangerState, ALeffectState, effect); ALfloat frequency = Device->Frequency; ALfloat rate; ALint phase; @@ -238,7 +238,7 @@ DECL_TEMPLATE(Sinusoid) static ALvoid FlangerProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALflangerState *state = GET_PARENT_TYPE(ALflangerState, ALeffectState, effect); + ALflangerState *state = STATIC_UPCAST(ALflangerState, ALeffectState, effect); if(state->waveform == AL_FLANGER_WAVEFORM_TRIANGLE) ProcessTriangle(state, SamplesToDo, SamplesIn, SamplesOut); @@ -254,17 +254,17 @@ ALeffectState *FlangerCreate(void) if(!state) return NULL; - 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; + STATIC_CAST(ALeffectState, state)->Destroy = FlangerDestroy; + STATIC_CAST(ALeffectState, state)->DeviceUpdate = FlangerDeviceUpdate; + STATIC_CAST(ALeffectState, state)->Update = FlangerUpdate; + STATIC_CAST(ALeffectState, state)->Process = FlangerProcess; state->BufferLength = 0; state->SampleBufferLeft = NULL; state->SampleBufferRight = NULL; state->offset = 0; - return GET_DERIVED_TYPE(ALeffectState, state); + return STATIC_CAST(ALeffectState, state); } void flanger_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) diff --git a/Alc/alcModulator.c b/Alc/alcModulator.c index c9f1edf4..daf5416c 100644 --- a/Alc/alcModulator.c +++ b/Alc/alcModulator.c @@ -131,7 +131,7 @@ DECL_TEMPLATE(Square) static ALvoid ModulatorDestroy(ALeffectState *effect) { - ALmodulatorState *state = GET_PARENT_TYPE(ALmodulatorState, ALeffectState, effect); + ALmodulatorState *state = STATIC_UPCAST(ALmodulatorState, ALeffectState, effect); free(state); } @@ -144,7 +144,7 @@ static ALboolean ModulatorDeviceUpdate(ALeffectState *effect, ALCdevice *Device) static ALvoid ModulatorUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { - ALmodulatorState *state = GET_PARENT_TYPE(ALmodulatorState, ALeffectState, effect); + ALmodulatorState *state = STATIC_UPCAST(ALmodulatorState, ALeffectState, effect); ALfloat gain, cw, a = 0.0f; ALuint index; @@ -177,7 +177,7 @@ static ALvoid ModulatorUpdate(ALeffectState *effect, ALCdevice *Device, const AL static ALvoid ModulatorProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALmodulatorState *state = GET_PARENT_TYPE(ALmodulatorState, ALeffectState, effect); + ALmodulatorState *state = STATIC_UPCAST(ALmodulatorState, ALeffectState, effect); switch(state->Waveform) { @@ -203,10 +203,10 @@ ALeffectState *ModulatorCreate(void) if(!state) return NULL; - GET_DERIVED_TYPE(ALeffectState, state)->Destroy = ModulatorDestroy; - GET_DERIVED_TYPE(ALeffectState, state)->DeviceUpdate = ModulatorDeviceUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Update = ModulatorUpdate; - GET_DERIVED_TYPE(ALeffectState, state)->Process = ModulatorProcess; + STATIC_CAST(ALeffectState, state)->Destroy = ModulatorDestroy; + STATIC_CAST(ALeffectState, state)->DeviceUpdate = ModulatorDeviceUpdate; + STATIC_CAST(ALeffectState, state)->Update = ModulatorUpdate; + STATIC_CAST(ALeffectState, state)->Process = ModulatorProcess; state->index = 0; state->step = 1; @@ -214,7 +214,7 @@ ALeffectState *ModulatorCreate(void) state->iirFilter.coeff = 0.0f; state->iirFilter.history[0] = 0.0f; - return GET_DERIVED_TYPE(ALeffectState, state); + return STATIC_CAST(ALeffectState, state); } void mod_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index ac9af905..71b21e1b 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -556,7 +556,7 @@ static __inline ALvoid EAXVerbPass(ALverbState *State, ALfloat in, ALfloat *REST // buffer. static ALvoid VerbProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALverbState *State = GET_PARENT_TYPE(ALverbState, ALeffectState, effect); + ALverbState *State = STATIC_UPCAST(ALverbState, ALeffectState, effect); ALfloat (*RESTRICT out)[4] = State->ReverbSamples; ALuint index, c; @@ -579,7 +579,7 @@ static ALvoid VerbProcess(ALeffectState *effect, ALuint SamplesToDo, const ALflo // buffer. static ALvoid EAXVerbProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALverbState *State = GET_PARENT_TYPE(ALverbState, ALeffectState, effect); + ALverbState *State = STATIC_UPCAST(ALverbState, ALeffectState, effect); ALfloat (*RESTRICT early)[4] = State->EarlySamples; ALfloat (*RESTRICT late)[4] = State->ReverbSamples; ALuint index, c; @@ -726,7 +726,7 @@ static ALboolean AllocLines(ALuint frequency, ALverbState *State) // format) have been changed. static ALboolean ReverbDeviceUpdate(ALeffectState *effect, ALCdevice *Device) { - ALverbState *State = GET_PARENT_TYPE(ALverbState, ALeffectState, effect); + ALverbState *State = STATIC_UPCAST(ALverbState, ALeffectState, effect); ALuint frequency = Device->Frequency, index; // Allocate the delay lines. @@ -1078,19 +1078,19 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection // effect is loaded into a slot. static ALvoid ReverbUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) { - ALverbState *State = GET_PARENT_TYPE(ALverbState, ALeffectState, effect); + ALverbState *State = STATIC_UPCAST(ALverbState, ALeffectState, effect); ALuint frequency = Device->Frequency; ALboolean isEAX = AL_FALSE; ALfloat cw, x, y, hfRatio; if(Slot->effect.type == AL_EFFECT_EAXREVERB && !EmulateEAXReverb) { - GET_DERIVED_TYPE(ALeffectState, State)->Process = EAXVerbProcess; + STATIC_CAST(ALeffectState, State)->Process = EAXVerbProcess; isEAX = AL_TRUE; } else if(Slot->effect.type == AL_EFFECT_REVERB || EmulateEAXReverb) { - GET_DERIVED_TYPE(ALeffectState, State)->Process = VerbProcess; + STATIC_CAST(ALeffectState, State)->Process = VerbProcess; isEAX = AL_FALSE; } @@ -1173,7 +1173,7 @@ static ALvoid ReverbUpdate(ALeffectState *effect, ALCdevice *Device, const ALeff // slot has a different (or no) effect loaded over the reverb effect. static ALvoid ReverbDestroy(ALeffectState *effect) { - ALverbState *State = GET_PARENT_TYPE(ALverbState, ALeffectState, effect); + ALverbState *State = STATIC_UPCAST(ALverbState, ALeffectState, effect); if(State) { free(State->SampleBuffer); @@ -1193,10 +1193,10 @@ ALeffectState *ReverbCreate(void) if(!State) return NULL; - GET_DERIVED_TYPE(ALeffectState, State)->Destroy = ReverbDestroy; - GET_DERIVED_TYPE(ALeffectState, State)->DeviceUpdate = ReverbDeviceUpdate; - GET_DERIVED_TYPE(ALeffectState, State)->Update = ReverbUpdate; - GET_DERIVED_TYPE(ALeffectState, State)->Process = VerbProcess; + STATIC_CAST(ALeffectState, State)->Destroy = ReverbDestroy; + STATIC_CAST(ALeffectState, State)->DeviceUpdate = ReverbDeviceUpdate; + STATIC_CAST(ALeffectState, State)->Update = ReverbUpdate; + STATIC_CAST(ALeffectState, State)->Process = VerbProcess; State->TotalSamples = 0; State->SampleBuffer = NULL; @@ -1278,7 +1278,7 @@ ALeffectState *ReverbCreate(void) State->Gain = State->Late.PanGain; - return GET_DERIVED_TYPE(ALeffectState, State); + return STATIC_CAST(ALeffectState, State); } void eaxreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index a1a90b2f..4cdaf783 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -62,9 +62,9 @@ static const union { #define COUNTOF(x) (sizeof((x))/sizeof((x)[0])) -#define DERIVE_FROM_TYPE(t) t t##_parent -#define GET_DERIVED_TYPE(t, o) (&(o)->t##_parent) -#define GET_PARENT_TYPE(t1, t2, o) ((t1*)((char*)(o) - offsetof(t1, t2##_parent))) +#define DERIVE_FROM_TYPE(t) t t##_parent +#define STATIC_CAST(to, obj) (&(obj)->to##_parent) +#define STATIC_UPCAST(to, from, obj) ((to*)((char*)(obj) - offsetof(to, from##_parent))) #ifdef _WIN32 |