diff options
author | Chris Robinson <[email protected]> | 2013-05-21 05:02:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-21 05:02:25 -0700 |
commit | 5c8c40afefc4e42635da91a876232cfc0975f6fd (patch) | |
tree | a05479e246a9494c1d590f9b080dee253c2505d9 /Alc | |
parent | 5516d8df0b21722c96189b946a8a10e9cbb0c001 (diff) |
Auto-generate wrappers to upcast objects before calling user methods
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alcChorus.c | 14 | ||||
-rw-r--r-- | Alc/alcDedicated.c | 15 | ||||
-rw-r--r-- | Alc/alcDistortion.c | 13 | ||||
-rw-r--r-- | Alc/alcEcho.c | 13 | ||||
-rw-r--r-- | Alc/alcEqualizer.c | 14 | ||||
-rw-r--r-- | Alc/alcFlanger.c | 14 | ||||
-rw-r--r-- | Alc/alcModulator.c | 14 | ||||
-rw-r--r-- | Alc/alcReverb.c | 15 |
8 files changed, 37 insertions, 75 deletions
diff --git a/Alc/alcChorus.c b/Alc/alcChorus.c index c34396eb..ff1c9492 100644 --- a/Alc/alcChorus.c +++ b/Alc/alcChorus.c @@ -50,10 +50,8 @@ typedef struct ALchorusState { ALfloat feedback; } ALchorusState; -static ALvoid ALchorusState_Destroy(ALeffectState *effect) +static ALvoid ALchorusState_Destroy(ALchorusState *state) { - ALchorusState *state = STATIC_UPCAST(ALchorusState, ALeffectState, effect); - free(state->SampleBufferLeft); state->SampleBufferLeft = NULL; @@ -63,9 +61,8 @@ static ALvoid ALchorusState_Destroy(ALeffectState *effect) free(state); } -static ALboolean ALchorusState_DeviceUpdate(ALeffectState *effect, ALCdevice *Device) +static ALboolean ALchorusState_DeviceUpdate(ALchorusState *state, ALCdevice *Device) { - ALchorusState *state = STATIC_UPCAST(ALchorusState, ALeffectState, effect); ALuint maxlen; ALuint it; @@ -96,9 +93,8 @@ static ALboolean ALchorusState_DeviceUpdate(ALeffectState *effect, ALCdevice *De return AL_TRUE; } -static ALvoid ALchorusState_Update(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALchorusState_Update(ALchorusState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALchorusState *state = STATIC_UPCAST(ALchorusState, ALeffectState, effect); ALfloat frequency = Device->Frequency; ALfloat rate; ALint phase; @@ -234,10 +230,8 @@ DECL_TEMPLATE(Sinusoid) #undef DECL_TEMPLATE -static ALvoid ALchorusState_Process(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) +static ALvoid ALchorusState_Process(ALchorusState *state, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALchorusState *state = STATIC_UPCAST(ALchorusState, ALeffectState, effect); - if(state->waveform == AL_CHORUS_WAVEFORM_TRIANGLE) ProcessTriangle(state, SamplesToDo, SamplesIn, SamplesOut); else if(state->waveform == AL_CHORUS_WAVEFORM_SINUSOID) diff --git a/Alc/alcDedicated.c b/Alc/alcDedicated.c index a3267509..7d32c153 100644 --- a/Alc/alcDedicated.c +++ b/Alc/alcDedicated.c @@ -36,22 +36,20 @@ typedef struct ALdedicatedState { } ALdedicatedState; -static ALvoid ALdedicatedState_Destroy(ALeffectState *effect) +static ALvoid ALdedicatedState_Destroy(ALdedicatedState *state) { - ALdedicatedState *state = STATIC_UPCAST(ALdedicatedState, ALeffectState, effect); free(state); } -static ALboolean ALdedicatedState_DeviceUpdate(ALeffectState *effect, ALCdevice *Device) +static ALboolean ALdedicatedState_DeviceUpdate(ALdedicatedState *state, ALCdevice *Device) { - (void)effect; - (void)Device; return AL_TRUE; + (void)state; + (void)Device; } -static ALvoid ALdedicatedState_Update(ALeffectState *effect, ALCdevice *device, const ALeffectslot *Slot) +static ALvoid ALdedicatedState_Update(ALdedicatedState *state, ALCdevice *device, const ALeffectslot *Slot) { - ALdedicatedState *state = STATIC_UPCAST(ALdedicatedState, ALeffectState, effect); ALfloat Gain; ALsizei s; @@ -65,9 +63,8 @@ static ALvoid ALdedicatedState_Update(ALeffectState *effect, ALCdevice *device, state->gains[LFE] = Gain; } -static ALvoid ALdedicatedState_Process(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) +static ALvoid ALdedicatedState_Process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALdedicatedState *state = STATIC_UPCAST(ALdedicatedState, ALeffectState, effect); const ALfloat *gains = state->gains; ALuint i, c; diff --git a/Alc/alcDistortion.c b/Alc/alcDistortion.c index 50627093..8c0f5e97 100644 --- a/Alc/alcDistortion.c +++ b/Alc/alcDistortion.c @@ -59,22 +59,20 @@ typedef struct ALdistortionState { ALfloat edge_coeff; } ALdistortionState; -static ALvoid ALdistortionState_Destroy(ALeffectState *effect) +static ALvoid ALdistortionState_Destroy(ALdistortionState *state) { - ALdistortionState *state = STATIC_UPCAST(ALdistortionState, ALeffectState, effect); free(state); } -static ALboolean ALdistortionState_DeviceUpdate(ALeffectState *effect, ALCdevice *Device) +static ALboolean ALdistortionState_DeviceUpdate(ALdistortionState *state, ALCdevice *Device) { return AL_TRUE; - (void)effect; + (void)state; (void)Device; } -static ALvoid ALdistortionState_Update(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALdistortionState_Update(ALdistortionState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALdistortionState *state = STATIC_UPCAST(ALdistortionState, ALeffectState, effect); ALfloat gain = sqrtf(1.0f / Device->NumChan) * Slot->Gain; ALfloat frequency = (ALfloat)Device->Frequency; ALuint it; @@ -126,9 +124,8 @@ static ALvoid ALdistortionState_Update(ALeffectState *effect, ALCdevice *Device, state->bandpass.a[2] = 1.0f - alpha; } -static ALvoid ALdistortionState_Process(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) +static ALvoid ALdistortionState_Process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALdistortionState *state = STATIC_UPCAST(ALdistortionState, ALeffectState, effect); const ALfloat fc = state->edge_coeff; float oversample_buffer[64][4]; ALfloat tempsmp; diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c index 3fbd5232..ada61c96 100644 --- a/Alc/alcEcho.c +++ b/Alc/alcEcho.c @@ -51,19 +51,16 @@ typedef struct ALechoState { ALfloat history[2]; } ALechoState; -static ALvoid ALechoState_Destroy(ALeffectState *effect) +static ALvoid ALechoState_Destroy(ALechoState *state) { - ALechoState *state = STATIC_UPCAST(ALechoState, ALeffectState, effect); - free(state->SampleBuffer); state->SampleBuffer = NULL; free(state); } -static ALboolean ALechoState_DeviceUpdate(ALeffectState *effect, ALCdevice *Device) +static ALboolean ALechoState_DeviceUpdate(ALechoState *state, ALCdevice *Device) { - 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 @@ -88,9 +85,8 @@ static ALboolean ALechoState_DeviceUpdate(ALeffectState *effect, ALCdevice *Devi return AL_TRUE; } -static ALvoid ALechoState_Update(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALechoState_Update(ALechoState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALechoState *state = STATIC_UPCAST(ALechoState, ALeffectState, effect); ALuint frequency = Device->Frequency; ALfloat lrpan, cw, g, gain; ALfloat dirGain; @@ -124,9 +120,8 @@ static ALvoid ALechoState_Update(ALeffectState *effect, ALCdevice *Device, const ComputeAngleGains(Device, atan2f(+lrpan, 0.0f), (1.0f-dirGain)*F_PI, gain, state->Gain[1]); } -static ALvoid ALechoState_Process(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) +static ALvoid ALechoState_Process(ALechoState *state, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - 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; diff --git a/Alc/alcEqualizer.c b/Alc/alcEqualizer.c index 50a83c9a..6bc4ed12 100644 --- a/Alc/alcEqualizer.c +++ b/Alc/alcEqualizer.c @@ -95,24 +95,19 @@ typedef struct ALequalizerState { ALfloat frequency; } ALequalizerState; -static ALvoid ALequalizerState_Destroy(ALeffectState *effect) +static ALvoid ALequalizerState_Destroy(ALequalizerState *state) { - ALequalizerState *state = STATIC_UPCAST(ALequalizerState, ALeffectState, effect); free(state); } -static ALboolean ALequalizerState_DeviceUpdate(ALeffectState *effect, ALCdevice *Device) +static ALboolean ALequalizerState_DeviceUpdate(ALequalizerState *state, ALCdevice *Device) { - ALequalizerState *state = STATIC_UPCAST(ALequalizerState, ALeffectState, effect); - state->frequency = (ALfloat)Device->Frequency; - return AL_TRUE; } -static ALvoid ALequalizerState_Update(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALequalizerState_Update(ALequalizerState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALequalizerState *state = STATIC_UPCAST(ALequalizerState, ALeffectState, effect); ALfloat gain = sqrtf(1.0f / Device->NumChan) * Slot->Gain; ALuint it; @@ -215,9 +210,8 @@ static ALvoid ALequalizerState_Update(ALeffectState *effect, ALCdevice *Device, } } -static ALvoid ALequalizerState_Process(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) +static ALvoid ALequalizerState_Process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALequalizerState *state = STATIC_UPCAST(ALequalizerState, ALeffectState, effect); ALuint base; ALuint it; ALuint kt; diff --git a/Alc/alcFlanger.c b/Alc/alcFlanger.c index a69d7006..574fa9d7 100644 --- a/Alc/alcFlanger.c +++ b/Alc/alcFlanger.c @@ -50,10 +50,8 @@ typedef struct ALflangerState { ALfloat feedback; } ALflangerState; -static ALvoid ALflangerState_Destroy(ALeffectState *effect) +static ALvoid ALflangerState_Destroy(ALflangerState *state) { - ALflangerState *state = STATIC_UPCAST(ALflangerState, ALeffectState, effect); - free(state->SampleBufferLeft); state->SampleBufferLeft = NULL; @@ -63,9 +61,8 @@ static ALvoid ALflangerState_Destroy(ALeffectState *effect) free(state); } -static ALboolean ALflangerState_DeviceUpdate(ALeffectState *effect, ALCdevice *Device) +static ALboolean ALflangerState_DeviceUpdate(ALflangerState *state, ALCdevice *Device) { - ALflangerState *state = STATIC_UPCAST(ALflangerState, ALeffectState, effect); ALuint maxlen; ALuint it; @@ -96,9 +93,8 @@ static ALboolean ALflangerState_DeviceUpdate(ALeffectState *effect, ALCdevice *D return AL_TRUE; } -static ALvoid ALflangerState_Update(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALflangerState_Update(ALflangerState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALflangerState *state = STATIC_UPCAST(ALflangerState, ALeffectState, effect); ALfloat frequency = Device->Frequency; ALfloat rate; ALint phase; @@ -234,10 +230,8 @@ DECL_TEMPLATE(Sinusoid) #undef DECL_TEMPLATE -static ALvoid ALflangerState_Process(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) +static ALvoid ALflangerState_Process(ALflangerState *state, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALflangerState *state = STATIC_UPCAST(ALflangerState, ALeffectState, effect); - if(state->waveform == AL_FLANGER_WAVEFORM_TRIANGLE) ProcessTriangle(state, SamplesToDo, SamplesIn, SamplesOut); else if(state->waveform == AL_FLANGER_WAVEFORM_SINUSOID) diff --git a/Alc/alcModulator.c b/Alc/alcModulator.c index b2ea6642..5d4fdab8 100644 --- a/Alc/alcModulator.c +++ b/Alc/alcModulator.c @@ -129,22 +129,20 @@ DECL_TEMPLATE(Square) #undef DECL_TEMPLATE -static ALvoid ALmodulatorState_Destroy(ALeffectState *effect) +static ALvoid ALmodulatorState_Destroy(ALmodulatorState *state) { - ALmodulatorState *state = STATIC_UPCAST(ALmodulatorState, ALeffectState, effect); free(state); } -static ALboolean ALmodulatorState_DeviceUpdate(ALeffectState *effect, ALCdevice *Device) +static ALboolean ALmodulatorState_DeviceUpdate(ALmodulatorState *state, ALCdevice *Device) { return AL_TRUE; - (void)effect; + (void)state; (void)Device; } -static ALvoid ALmodulatorState_Update(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALmodulatorState_Update(ALmodulatorState *state, ALCdevice *Device, const ALeffectslot *Slot) { - ALmodulatorState *state = STATIC_UPCAST(ALmodulatorState, ALeffectState, effect); ALfloat gain, cw, a = 0.0f; ALuint index; @@ -175,10 +173,8 @@ static ALvoid ALmodulatorState_Update(ALeffectState *effect, ALCdevice *Device, } } -static ALvoid ALmodulatorState_Process(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) +static ALvoid ALmodulatorState_Process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALmodulatorState *state = STATIC_UPCAST(ALmodulatorState, ALeffectState, effect); - switch(state->Waveform) { case SINUSOID: diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index b84dad96..2bed00a5 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -606,9 +606,8 @@ static ALvoid ALreverbState_ProcessEax(ALreverbState *State, ALuint SamplesToDo, } } -static ALvoid ALreverbState_Process(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) +static ALvoid ALreverbState_Process(ALreverbState *State, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]) { - ALreverbState *State = STATIC_UPCAST(ALreverbState, ALeffectState, effect); if(State->IsEax) ALreverbState_ProcessEax(State, SamplesToDo, SamplesIn, SamplesOut); else @@ -732,9 +731,8 @@ static ALboolean AllocLines(ALuint frequency, ALreverbState *State) // This updates the device-dependant EAX reverb state. This is called on // initialization and any time the device parameters (eg. playback frequency, // format) have been changed. -static ALboolean ALreverbState_DeviceUpdate(ALeffectState *effect, ALCdevice *Device) +static ALboolean ALreverbState_DeviceUpdate(ALreverbState *State, ALCdevice *Device) { - ALreverbState *State = STATIC_UPCAST(ALreverbState, ALeffectState, effect); ALuint frequency = Device->Frequency, index; // Allocate the delay lines. @@ -1084,9 +1082,8 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection // This updates the EAX reverb state. This is called any time the EAX reverb // effect is loaded into a slot. -static ALvoid ALreverbState_Update(ALeffectState *effect, ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALreverbState_Update(ALreverbState *State, ALCdevice *Device, const ALeffectslot *Slot) { - ALreverbState *State = STATIC_UPCAST(ALreverbState, ALeffectState, effect); ALuint frequency = Device->Frequency; ALfloat cw, x, y, hfRatio; @@ -1174,10 +1171,8 @@ static ALvoid ALreverbState_Update(ALeffectState *effect, ALCdevice *Device, con // This destroys the reverb state. It should be called only when the effect // slot has a different (or no) effect loaded over the reverb effect. -static ALvoid ALreverbState_Destroy(ALeffectState *effect) +static ALvoid ALreverbState_Destroy(ALreverbState *State) { - ALreverbState *State = STATIC_UPCAST(ALreverbState, ALeffectState, effect); - free(State->SampleBuffer); State->SampleBuffer = NULL; @@ -1190,7 +1185,7 @@ DEFINE_ALEFFECTSTATE_VTABLE(ALreverbState); // effect is loaded into a slot that doesn't already have a reverb effect. ALeffectState *ReverbCreate(void) { - ALreverbState *State = NULL; + ALreverbState *State; ALuint index; State = malloc(sizeof(ALreverbState)); |