From 5c8c40afefc4e42635da91a876232cfc0975f6fd Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 21 May 2013 05:02:25 -0700 Subject: Auto-generate wrappers to upcast objects before calling user methods --- OpenAL32/Include/alAuxEffectSlot.h | 25 +++++++++++++++++-------- OpenAL32/alAuxEffectSlot.c | 8 ++++---- 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'OpenAL32') diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index a891b52a..ed0d1887 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -12,10 +12,10 @@ typedef struct ALeffectState ALeffectState; typedef struct ALeffectslot ALeffectslot; struct ALeffectStateVtable { - ALvoid (*const Destroy)(ALeffectState *State); - ALboolean (*const DeviceUpdate)(ALeffectState *State, ALCdevice *Device); - ALvoid (*const Update)(ALeffectState *State, ALCdevice *Device, const ALeffectslot *Slot); - ALvoid (*const Process)(ALeffectState *State, ALuint SamplesToDo, const ALfloat *RESTRICT SamplesIn, ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE]); + ALvoid (*const Destroy)(ALeffectState *state); + ALboolean (*const DeviceUpdate)(ALeffectState *state, ALCdevice *device); + ALvoid (*const Update)(ALeffectState *state, ALCdevice *device, const ALeffectslot *slot); + ALvoid (*const Process)(ALeffectState *state, ALuint samplesToDo, const ALfloat *RESTRICT samplesIn, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE]); }; struct ALeffectState { @@ -23,11 +23,20 @@ struct ALeffectState { }; #define DEFINE_ALEFFECTSTATE_VTABLE(T) \ +static ALvoid T##_ALeffectState_Destroy(ALeffectState *state) \ +{ T##_Destroy(STATIC_UPCAST(T, ALeffectState, state)); } \ +static ALboolean T##_ALeffectState_DeviceUpdate(ALeffectState *state, ALCdevice *device) \ +{ return T##_DeviceUpdate(STATIC_UPCAST(T, ALeffectState, state), device); } \ +static ALvoid T##_ALeffectState_Update(ALeffectState *state, ALCdevice *device, const ALeffectslot *slot) \ +{ T##_Update(STATIC_UPCAST(T, ALeffectState, state), device, slot); } \ +static ALvoid T##_ALeffectState_Process(ALeffectState *state, ALuint samplesToDo, const ALfloat *RESTRICT samplesIn, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE]) \ +{ T##_Process(STATIC_UPCAST(T, ALeffectState, state), samplesToDo, samplesIn, samplesOut); } \ + \ static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \ - T##_Destroy, \ - T##_DeviceUpdate, \ - T##_Update, \ - T##_Process \ + T##_ALeffectState_Destroy, \ + T##_ALeffectState_DeviceUpdate, \ + T##_ALeffectState_Update, \ + T##_ALeffectState_Process \ } #define SET_VTABLE1(T1, obj) ((obj)->vtbl = &(T1##_vtable)) diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 0932376d..3c31ecb8 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -397,21 +397,21 @@ typedef struct ALnoneState { DERIVE_FROM_TYPE(ALeffectState); } ALnoneState; -static ALvoid ALnoneState_Destroy(ALeffectState *state) +static ALvoid ALnoneState_Destroy(ALnoneState *state) { free(state); } -static ALboolean ALnoneState_DeviceUpdate(ALeffectState *state, ALCdevice *device) +static ALboolean ALnoneState_DeviceUpdate(ALnoneState *state, ALCdevice *device) { return AL_TRUE; (void)state; (void)device; } -static ALvoid ALnoneState_Update(ALeffectState *state, ALCdevice *device, const ALeffectslot *slot) +static ALvoid ALnoneState_Update(ALnoneState *state, ALCdevice *device, const ALeffectslot *slot) { (void)state; (void)device; (void)slot; } -static ALvoid ALnoneState_Process(ALeffectState *state, ALuint samplesToDo, const ALfloat *RESTRICT samplesIn, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE]) +static ALvoid ALnoneState_Process(ALnoneState *state, ALuint samplesToDo, const ALfloat *RESTRICT samplesIn, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE]) { (void)state; (void)samplesToDo; -- cgit v1.2.3