diff options
author | Chris Robinson <[email protected]> | 2013-05-27 11:48:29 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-27 11:48:29 -0700 |
commit | 9e84f38a46f49230bf836e8a33b0637c000d659b (patch) | |
tree | 733ee48b1c03794731ff1e0f2454b0db52886e5c /OpenAL32 | |
parent | 06c8442af67fcb38241d2f13a649fc8d4dedaa85 (diff) |
Use generic VCALL[_NOARGS] macros instead of type-specific wrappers
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 5 | ||||
-rw-r--r-- | OpenAL32/Include/alEffect.h | 10 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 12 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 4 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 16 | ||||
-rw-r--r-- | OpenAL32/alState.c | 2 |
6 files changed, 21 insertions, 28 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 24614fa4..d496df8d 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -26,11 +26,6 @@ struct ALeffectState { const struct ALeffectStateVtable *vtbl; }; -#define ALeffectState_Destruct(a) ((a)->vtbl->Destruct((a))) -#define ALeffectState_DeviceUpdate(a,b) ((a)->vtbl->DeviceUpdate((a),(b))) -#define ALeffectState_Update(a,b,c) ((a)->vtbl->Update((a),(b),(c))) -#define ALeffectState_Process(a,b,c,d) ((a)->vtbl->Process((a),(b),(c),(d))) - #define DEFINE_ALEFFECTSTATE_VTABLE(T) \ static ALvoid T##_ALeffectState_Destruct(ALeffectState *state) \ { T##_Destruct(STATIC_UPCAST(T, ALeffectState, state)); } \ diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index 6399ff38..a685681e 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -162,16 +162,6 @@ typedef struct ALeffect { ALuint id; } ALeffect; -#define ALeffect_SetParami(x, c, p, v) ((x)->vtbl->SetParami((x),(c),(p),(v))) -#define ALeffect_SetParamiv(x, c, p, v) ((x)->vtbl->SetParamiv((x),(c),(p),(v))) -#define ALeffect_SetParamf(x, c, p, v) ((x)->vtbl->SetParamf((x),(c),(p),(v))) -#define ALeffect_SetParamfv(x, c, p, v) ((x)->vtbl->SetParamfv((x),(c),(p),(v))) - -#define ALeffect_GetParami(x, c, p, v) ((x)->vtbl->GetParami((x),(c),(p),(v))) -#define ALeffect_GetParamiv(x, c, p, v) ((x)->vtbl->GetParamiv((x),(c),(p),(v))) -#define ALeffect_GetParamf(x, c, p, v) ((x)->vtbl->GetParamf((x),(c),(p),(v))) -#define ALeffect_GetParamfv(x, c, p, v) ((x)->vtbl->GetParamfv((x),(c),(p),(v))) - static __inline ALboolean IsReverbEffect(ALenum type) { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; } diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index a7c79b2a..16df2330 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -70,9 +70,17 @@ static const union { #define SET_VTABLE1(T1, obj) ((obj)->vtbl = &(T1##_vtable)) #define SET_VTABLE2(T1, T2, obj) SET_VTABLE1(T1##_##T2, STATIC_CAST(T2, (obj))) +/* Helper to extract an argument list for VCALL. Not used directly. */ +#define EXTRACT_VCALL_ARGS(...) __VA_ARGS__ + +/* Call a "virtual" method on an object, with arguments. */ +#define VCALL(obj, func, args) (((obj)->vtbl->func)((obj), EXTRACT_VCALL_ARGS args)) +/* Call a "virtual" method on an object, with no arguments. */ +#define VCALL_NOARGS(obj, func) (((obj)->vtbl->func)((obj))) + #define DELETE_OBJ(obj) do { \ - (obj)->vtbl->Destruct((obj)); \ - (obj)->vtbl->Delete((obj)); \ + VCALL_NOARGS((obj),Destruct); \ + VCALL_NOARGS((obj),Delete); \ } while(0) diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index e2d9b42d..14dd8816 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -493,7 +493,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e SetMixerFPUMode(&oldMode); ALCdevice_Lock(Device); - if(ALeffectState_DeviceUpdate(State, Device) == AL_FALSE) + if(VCALL(State,DeviceUpdate,(Device)) == AL_FALSE) { ALCdevice_Unlock(Device); RestoreFPUMode(&oldMode); @@ -517,7 +517,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e * object was changed, it needs an update before its Process method can * be called. */ EffectSlot->NeedsUpdate = AL_FALSE; - ALeffectState_Update(EffectSlot->EffectState, Device, EffectSlot); + VCALL(EffectSlot->EffectState,Update,(Device, EffectSlot)); ALCdevice_Unlock(Device); RestoreFPUMode(&oldMode); diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 827a2439..425d2b60 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -167,7 +167,7 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value) else { /* Call the appropriate handler */ - ALeffect_SetParami(ALEffect, Context, param, value); + VCALL(ALEffect,SetParami,(Context, param, value)); } } @@ -196,7 +196,7 @@ AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *v else { /* Call the appropriate handler */ - ALeffect_SetParamiv(ALEffect, Context, param, values); + VCALL(ALEffect,SetParamiv,(Context, param, values)); } ALCcontext_DecRef(Context); @@ -217,7 +217,7 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value) else { /* Call the appropriate handler */ - ALeffect_SetParamf(ALEffect, Context, param, value); + VCALL(ALEffect,SetParamf,(Context, param, value)); } ALCcontext_DecRef(Context); @@ -238,7 +238,7 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat else { /* Call the appropriate handler */ - ALeffect_SetParamfv(ALEffect, Context, param, values); + VCALL(ALEffect,SetParamfv,(Context, param, values)); } ALCcontext_DecRef(Context); @@ -263,7 +263,7 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value else { /* Call the appropriate handler */ - ALeffect_GetParami(ALEffect, Context, param, value); + VCALL(ALEffect,GetParami,(Context, param, value)); } } @@ -292,7 +292,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *valu else { /* Call the appropriate handler */ - ALeffect_GetParamiv(ALEffect, Context, param, values); + VCALL(ALEffect,GetParamiv,(Context, param, values)); } ALCcontext_DecRef(Context); @@ -313,7 +313,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *val else { /* Call the appropriate handler */ - ALeffect_GetParamf(ALEffect, Context, param, value); + VCALL(ALEffect,GetParamf,(Context, param, value)); } ALCcontext_DecRef(Context); @@ -334,7 +334,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *va else { /* Call the appropriate handler */ - ALeffect_GetParamfv(ALEffect, Context, param, values); + VCALL(ALEffect,GetParamfv,(Context, param, values)); } ALCcontext_DecRef(Context); diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 9341050f..ab39afed 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -625,7 +625,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) while(slot != slot_end) { if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) - ALeffectState_Update((*slot)->EffectState, Context->Device, *slot); + VCALL((*slot)->EffectState,Update,(Context->Device, *slot)); slot++; } |