diff options
author | Chris Robinson <[email protected]> | 2013-10-29 20:08:03 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-10-29 20:13:42 -0700 |
commit | bc9c3de96963dc47df9a5851f3c500e8a6404966 (patch) | |
tree | d1bfa93bec516e4f7f9c5273537481aee898f6fe /OpenAL32/Include/alAuxEffectSlot.h | |
parent | 9f0e49917d808b93e0c47ce4fa2cbf7050cfe65a (diff) |
Use a helper macro for making vtable thunks
Diffstat (limited to 'OpenAL32/Include/alAuxEffectSlot.h')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 71898964..73b4b67b 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -16,26 +16,25 @@ typedef struct ALeffectState { } ALeffectState; struct ALeffectStateVtable { - ALvoid (*const Destruct)(ALeffectState *state); + void (*const Destruct)(ALeffectState *state); ALboolean (*const deviceUpdate)(ALeffectState *state, ALCdevice *device); - ALvoid (*const update)(ALeffectState *state, ALCdevice *device, const struct ALeffectslot *slot); - ALvoid (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat *restrict samplesIn, ALfloat (*restrict samplesOut)[BUFFERSIZE]); + void (*const update)(ALeffectState *state, ALCdevice *device, const struct ALeffectslot *slot); + void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat *restrict samplesIn, ALfloat (*restrict samplesOut)[BUFFERSIZE]); void (*const Delete)(struct ALeffectState *state); }; +/* Small hack to use a pointer-to-array type as a normal argument type. + * Shouldn't be used directly. */ +typedef ALfloat ALfloatBUFFERSIZE[BUFFERSIZE]; + #define DEFINE_ALEFFECTSTATE_VTABLE(T) \ -static ALvoid T##_ALeffectState_Destruct(ALeffectState *state) \ -{ T##_Destruct(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 ALvoid T##_ALeffectState_Delete(ALeffectState *state) \ -{ T##_Delete(STATIC_UPCAST(T, ALeffectState, state)); } \ +DECLARE_THUNK(T, ALeffectState, void, Destruct) \ +DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \ +DECLARE_THUNK2(T, ALeffectState, void, update, ALCdevice*, const ALeffectslot*) \ +DECLARE_THUNK3(T, ALeffectState, void, process, ALuint, const ALfloat*restrict, ALfloatBUFFERSIZE*restrict) \ +DECLARE_THUNK(T, ALeffectState, void, Delete) \ \ static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \ T##_ALeffectState_Destruct, \ @@ -59,8 +58,7 @@ struct ALeffectStateFactoryVtable { }; #define DEFINE_ALEFFECTSTATEFACTORY_VTABLE(T) \ -static ALeffectState* T##_ALeffectStateFactory_create(ALeffectStateFactory *factory) \ -{ return T##_create(STATIC_UPCAST(T, ALeffectStateFactory, factory)); } \ +DECLARE_THUNK(T, ALeffectStateFactory, ALeffectState*, create) \ \ static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = { \ T##_ALeffectStateFactory_create, \ |