aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-05-27 11:48:29 -0700
committerChris Robinson <[email protected]>2013-05-27 11:48:29 -0700
commit9e84f38a46f49230bf836e8a33b0637c000d659b (patch)
tree733ee48b1c03794731ff1e0f2454b0db52886e5c
parent06c8442af67fcb38241d2f13a649fc8d4dedaa85 (diff)
Use generic VCALL[_NOARGS] macros instead of type-specific wrappers
-rw-r--r--Alc/ALc.c8
-rw-r--r--Alc/ALu.c12
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h5
-rw-r--r--OpenAL32/Include/alEffect.h10
-rw-r--r--OpenAL32/Include/alMain.h12
-rw-r--r--OpenAL32/alAuxEffectSlot.c4
-rw-r--r--OpenAL32/alEffect.c16
-rw-r--r--OpenAL32/alState.c2
8 files changed, 31 insertions, 38 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 4472d9e6..975fe661 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1707,7 +1707,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
{
ALeffectslot *slot = context->EffectSlotMap.array[pos].value;
- if(ALeffectState_DeviceUpdate(slot->EffectState, device) == AL_FALSE)
+ if(VCALL(slot->EffectState,DeviceUpdate,(device)) == AL_FALSE)
{
UnlockUIntMapRead(&context->EffectSlotMap);
ALCdevice_Unlock(device);
@@ -1715,7 +1715,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
return ALC_INVALID_DEVICE;
}
slot->NeedsUpdate = AL_FALSE;
- ALeffectState_Update(slot->EffectState, device, slot);
+ VCALL(slot->EffectState,Update,(device, slot));
}
UnlockUIntMapRead(&context->EffectSlotMap);
@@ -1744,14 +1744,14 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
{
ALeffectslot *slot = device->DefaultSlot;
- if(ALeffectState_DeviceUpdate(slot->EffectState, device) == AL_FALSE)
+ if(VCALL(slot->EffectState,DeviceUpdate,(device)) == AL_FALSE)
{
ALCdevice_Unlock(device);
RestoreFPUMode(&oldMode);
return ALC_INVALID_DEVICE;
}
slot->NeedsUpdate = AL_FALSE;
- ALeffectState_Update(slot->EffectState, device, slot);
+ VCALL(slot->EffectState,Update,(device, slot));
}
ALCdevice_Unlock(device);
RestoreFPUMode(&oldMode);
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 2f005b77..4d6c46da 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1041,10 +1041,10 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
(*slot)->PendingClicks[0] = 0.0f;
if(!DeferUpdates && ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
- ALeffectState_Update((*slot)->EffectState, device, *slot);
+ VCALL((*slot)->EffectState,Update,(device, *slot));
- ALeffectState_Process((*slot)->EffectState, SamplesToDo,
- (*slot)->WetBuffer[0], device->DryBuffer);
+ VCALL((*slot)->EffectState,Process,(SamplesToDo, (*slot)->WetBuffer[0],
+ device->DryBuffer));
for(i = 0;i < SamplesToDo;i++)
(*slot)->WetBuffer[0][i] = 0.0f;
@@ -1070,10 +1070,10 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
(*slot)->PendingClicks[0] = 0.0f;
if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
- ALeffectState_Update((*slot)->EffectState, device, *slot);
+ VCALL((*slot)->EffectState,Update,(device, *slot));
- ALeffectState_Process((*slot)->EffectState, SamplesToDo,
- (*slot)->WetBuffer[0], device->DryBuffer);
+ VCALL((*slot)->EffectState,Process,(SamplesToDo, (*slot)->WetBuffer[0],
+ device->DryBuffer));
for(i = 0;i < SamplesToDo;i++)
(*slot)->WetBuffer[0][i] = 0.0f;
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++;
}