aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-10-28 11:06:04 -0700
committerChris Robinson <[email protected]>2013-10-28 11:06:04 -0700
commit034935b2e16a5886377018de973e90490102ca90 (patch)
treeed163dea3eb8fcc9ed988573cd079ba4af642b72
parentc1cdd3095bf2334298b6965f5e4f49510a826bd6 (diff)
Modify how VCALL is handled
Now instead of specifying the arguments as a third argument to the macro, like VCALL(object,function,(arg1, arg2)); they are specified separately after the macro, like VCALL(object,function)(arg1, arg2); Also, VCALL_NOARGS has been removed in favor of VCALL0, which behaves like above but expects an empty argument list (a separate macro is needed to work around preprocessor limitations).
-rw-r--r--Alc/ALc.c52
-rw-r--r--Alc/ALu.c12
-rw-r--r--OpenAL32/Include/alMain.h12
-rw-r--r--OpenAL32/alAuxEffectSlot.c8
-rw-r--r--OpenAL32/alEffect.c16
-rw-r--r--OpenAL32/alState.c2
6 files changed, 51 insertions, 51 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index f98f5af2..2cbc7331 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1104,20 +1104,20 @@ static void alc_initconfig(void)
if(BackendList[i].getFactory)
{
ALCbackendFactory *factory = BackendList[i].getFactory();
- if(!VCALL0(factory,init,()))
+ if(!VCALL0(factory,init)())
{
WARN("Failed to initialize backend \"%s\"\n", BackendList[i].name);
continue;
}
TRACE("Initialized backend \"%s\"\n", BackendList[i].name);
- if(!PlaybackBackend.name && VCALL(factory,support,(ALCbackend_Playback)))
+ if(!PlaybackBackend.name && VCALL(factory,support)(ALCbackend_Playback))
{
PlaybackBackend = BackendList[i];
TRACE("Added \"%s\" for playback\n", PlaybackBackend.name);
}
#if 0
- if(!CaptureBackend.name && VCALL(factory,support,(ALCbackend_Capture)))
+ if(!CaptureBackend.name && VCALL(factory,support)(ALCbackend_Capture))
{
CaptureBackend = BackendList[i];
TRACE("Added \"%s\" for capture\n", CaptureBackend.name);
@@ -1239,7 +1239,7 @@ static void alc_deinit(void)
else
{
ALCbackendFactory *factory = BackendList[i].getFactory();
- VCALL0(factory,deinit,());
+ VCALL0(factory,deinit)();
}
}
BackendLoopback.Deinit();
@@ -1267,7 +1267,7 @@ static void ProbeList(ALCchar **list, size_t *listsize, enum DevProbe type)
else
{
ALCbackendFactory *factory = PlaybackBackend.getFactory();
- VCALL(factory,probe,(type));
+ VCALL(factory,probe)(type);
}
}
else if(type == CAPTURE_DEVICE_PROBE && (CaptureBackend.Probe || CaptureBackend.getFactory))
@@ -1277,7 +1277,7 @@ static void ProbeList(ALCchar **list, size_t *listsize, enum DevProbe type)
else
{
ALCbackendFactory *factory = CaptureBackend.getFactory();
- VCALL(factory,probe,(type));
+ VCALL(factory,probe)(type);
}
}
UnlockLists();
@@ -1480,27 +1480,27 @@ ALint64 ALCdevice_GetLatencyDefault(ALCdevice *UNUSED(device))
ALint64 alcGetLatency(ALCdevice *device)
{
- return VCALL0(device->Backend,getLatency,());
+ return VCALL0(device->Backend,getLatency)();
}
void ALCdevice_Lock(ALCdevice *device)
{
- return VCALL0(device->Backend,lock,());
+ VCALL0(device->Backend,lock)();
}
void ALCdevice_Unlock(ALCdevice *device)
{
- return VCALL0(device->Backend,unlock,());
+ VCALL0(device->Backend,unlock)();
}
void LockContext(ALCcontext *context)
{
- VCALL0(context->Device->Backend,lock,());
+ ALCdevice_Lock(context->Device);
}
void UnlockContext(ALCcontext *context)
{
- VCALL0(context->Device->Backend,unlock,());
+ ALCdevice_Unlock(context->Device);
}
@@ -1746,7 +1746,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
numSends = minu(MAX_SENDS, numSends);
if((device->Flags&DEVICE_RUNNING))
- VCALL0(device->Backend,stop,());
+ VCALL0(device->Backend,stop)();
device->Flags &= ~DEVICE_RUNNING;
device->Frequency = freq;
@@ -1764,7 +1764,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
/* If a context is already running on the device, stop playback so the
* device attributes can be updated. */
if((device->Flags&DEVICE_RUNNING))
- VCALL0(device->Backend,close,());
+ VCALL0(device->Backend,close)();
device->Flags &= ~DEVICE_RUNNING;
freq = device->Frequency;
@@ -1849,7 +1849,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
DEVICE_FREQUENCY_REQUEST;
}
- if(VCALL0(device->Backend,reset,()) == ALC_FALSE)
+ if(VCALL0(device->Backend,reset)() == ALC_FALSE)
return ALC_INVALID_DEVICE;
if(device->FmtChans != oldChans && (device->Flags&DEVICE_CHANNELS_REQUEST))
@@ -1940,7 +1940,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
{
ALeffectslot *slot = context->EffectSlotMap.array[pos].value;
- if(VCALL(slot->EffectState,deviceUpdate,(device)) == AL_FALSE)
+ if(VCALL(slot->EffectState,deviceUpdate)(device) == AL_FALSE)
{
UnlockUIntMapRead(&context->EffectSlotMap);
ALCdevice_Unlock(device);
@@ -1948,7 +1948,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
return ALC_INVALID_DEVICE;
}
slot->NeedsUpdate = AL_FALSE;
- VCALL(slot->EffectState,update,(device, slot));
+ VCALL(slot->EffectState,update)(device, slot);
}
UnlockUIntMapRead(&context->EffectSlotMap);
@@ -1977,19 +1977,19 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
{
ALeffectslot *slot = device->DefaultSlot;
- if(VCALL(slot->EffectState,deviceUpdate,(device)) == AL_FALSE)
+ if(VCALL(slot->EffectState,deviceUpdate)(device) == AL_FALSE)
{
ALCdevice_Unlock(device);
RestoreFPUMode(&oldMode);
return ALC_INVALID_DEVICE;
}
slot->NeedsUpdate = AL_FALSE;
- VCALL(slot->EffectState,update,(device, slot));
+ VCALL(slot->EffectState,update)(device, slot);
}
ALCdevice_Unlock(device);
RestoreFPUMode(&oldMode);
- if(VCALL0(device->Backend,start,()) == ALC_FALSE)
+ if(VCALL0(device->Backend,start)() == ALC_FALSE)
return ALC_INVALID_DEVICE;
device->Flags |= DEVICE_RUNNING;
@@ -2006,7 +2006,7 @@ static ALCvoid FreeDevice(ALCdevice *device)
TRACE("%p\n", device);
if(device->Type != Capture)
- VCALL0(device->Backend,close,());
+ VCALL0(device->Backend,close)();
else
ALCdevice_CloseCapture(device);
DELETE_OBJ(device->Backend);
@@ -2783,7 +2783,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
{
if(!device->ContextList)
{
- VCALL0(device->Backend,stop,());
+ VCALL0(device->Backend,stop)();
device->Flags &= ~DEVICE_RUNNING;
}
UnlockLists();
@@ -2827,7 +2827,7 @@ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context)
ReleaseContext(context, Device);
if(!Device->ContextList)
{
- VCALL0(Device->Backend,stop,());
+ VCALL0(Device->Backend,stop)();
Device->Flags &= ~DEVICE_RUNNING;
}
}
@@ -2993,7 +2993,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
else
{
ALCbackendFactory *factory = PlaybackBackend.getFactory();
- device->Backend = VCALL(factory,createBackend,(device));
+ device->Backend = VCALL(factory,createBackend)(device);
}
if(!device->Backend)
{
@@ -3140,7 +3140,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
device->NumMonoSources = device->MaxNoOfSources - device->NumStereoSources;
// Find a playback device to open
- if((err=VCALL(device->Backend,open,(deviceName))) != ALC_NO_ERROR)
+ if((err=VCALL(device->Backend,open)(deviceName)) != ALC_NO_ERROR)
{
DELETE_OBJ(device->Backend);
DeleteCriticalSection(&device->Mutex);
@@ -3204,7 +3204,7 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *Device)
ReleaseContext(ctx, Device);
}
if((Device->Flags&DEVICE_RUNNING))
- VCALL0(Device->Backend,stop,());
+ VCALL0(Device->Backend,stop)();
Device->Flags &= ~DEVICE_RUNNING;
ALCdevice_DecRef(Device);
@@ -3442,7 +3442,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN
device->NumMonoSources = device->MaxNoOfSources - device->NumStereoSources;
// Open the "backend"
- VCALL(device->Backend,open,("Loopback"));
+ VCALL(device->Backend,open)("Loopback");
do {
device->next = DeviceList;
} while(!CompExchangePtr((XchgPtr*)&DeviceList, device->next, device));
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 992d3e58..e6397208 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1051,10 +1051,10 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
(*slot)->PendingClicks[0] = 0.0f;
if(!DeferUpdates && ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
- VCALL((*slot)->EffectState,update,(device, *slot));
+ VCALL((*slot)->EffectState,update)(device, *slot);
- VCALL((*slot)->EffectState,process,(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;
@@ -1080,10 +1080,10 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
(*slot)->PendingClicks[0] = 0.0f;
if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
- VCALL((*slot)->EffectState,update,(device, *slot));
+ VCALL((*slot)->EffectState,update)(device, *slot);
- VCALL((*slot)->EffectState,process,(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/alMain.h b/OpenAL32/Include/alMain.h
index 74c5b0e6..b103848c 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -99,20 +99,20 @@ static const union {
#define SET_VTABLE1(T1, obj) ((obj)->vtbl = GET_VTABLE1(T1))
#define SET_VTABLE2(T1, T2, obj) (STATIC_CAST(T2, obj)->vtbl = GET_VTABLE2(T1, T2))
+
/* Helper to extract an argument list for VCALL. Not used directly. */
-#define EXTRACT_VCALL_ARGS(...) __VA_ARGS__
+#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))
+#define VCALL(obj, func) ((obj)->vtbl->func((obj), EXTRACT_VCALL_ARGS
/* Call a "virtual" method on an object, with no arguments. */
-#define VCALL0(obj, func, args) ((obj)->vtbl->func((obj)))
-#define VCALL_NOARGS(obj, func) ((obj)->vtbl->func((obj)))
+#define VCALL0(obj, func) ((obj)->vtbl->func((obj) EXTRACT_VCALL_ARGS
#define DELETE_OBJ(obj) do { \
if((obj) != NULL) \
{ \
- VCALL_NOARGS((obj),Destruct); \
- VCALL_NOARGS((obj),Delete); \
+ VCALL0((obj),Destruct)(); \
+ VCALL0((obj),Delete)(); \
} \
} while(0)
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index ae706231..6c454f74 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -466,14 +466,14 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e
ERR("Failed to find factory for effect type 0x%04x\n", newtype);
return AL_INVALID_ENUM;
}
- State = VCALL_NOARGS(factory,create);
+ State = VCALL0(factory,create)();
if(!State)
return AL_OUT_OF_MEMORY;
SetMixerFPUMode(&oldMode);
ALCdevice_Lock(Device);
- if(VCALL(State,deviceUpdate,(Device)) == AL_FALSE)
+ if(VCALL(State,deviceUpdate)(Device) == AL_FALSE)
{
ALCdevice_Unlock(Device);
RestoreFPUMode(&oldMode);
@@ -497,7 +497,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;
- VCALL(EffectSlot->EffectState,update,(Device, EffectSlot));
+ VCALL(EffectSlot->EffectState,update)(Device, EffectSlot);
ALCdevice_Unlock(Device);
RestoreFPUMode(&oldMode);
@@ -528,7 +528,7 @@ ALenum InitEffectSlot(ALeffectslot *slot)
slot->EffectType = AL_EFFECT_NULL;
factory = getFactoryByType(AL_EFFECT_NULL);
- if(!(slot->EffectState=VCALL_NOARGS(factory,create)))
+ if(!(slot->EffectState=VCALL0(factory,create)()))
return AL_OUT_OF_MEMORY;
slot->Gain = 1.0;
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index 7ed4e58e..550baaaa 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -164,7 +164,7 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value)
else
{
/* Call the appropriate handler */
- VCALL(ALEffect,setParami,(Context, param, value));
+ VCALL(ALEffect,setParami)(Context, param, value);
}
}
@@ -193,7 +193,7 @@ AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *v
else
{
/* Call the appropriate handler */
- VCALL(ALEffect,setParamiv,(Context, param, values));
+ VCALL(ALEffect,setParamiv)(Context, param, values);
}
ALCcontext_DecRef(Context);
@@ -214,7 +214,7 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value)
else
{
/* Call the appropriate handler */
- VCALL(ALEffect,setParamf,(Context, param, value));
+ VCALL(ALEffect,setParamf)(Context, param, value);
}
ALCcontext_DecRef(Context);
@@ -235,7 +235,7 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat
else
{
/* Call the appropriate handler */
- VCALL(ALEffect,setParamfv,(Context, param, values));
+ VCALL(ALEffect,setParamfv)(Context, param, values);
}
ALCcontext_DecRef(Context);
@@ -260,7 +260,7 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value
else
{
/* Call the appropriate handler */
- VCALL(ALEffect,getParami,(Context, param, value));
+ VCALL(ALEffect,getParami)(Context, param, value);
}
}
@@ -289,7 +289,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *valu
else
{
/* Call the appropriate handler */
- VCALL(ALEffect,getParamiv,(Context, param, values));
+ VCALL(ALEffect,getParamiv)(Context, param, values);
}
ALCcontext_DecRef(Context);
@@ -310,7 +310,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *val
else
{
/* Call the appropriate handler */
- VCALL(ALEffect,getParamf,(Context, param, value));
+ VCALL(ALEffect,getParamf)(Context, param, value);
}
ALCcontext_DecRef(Context);
@@ -331,7 +331,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *va
else
{
/* Call the appropriate handler */
- VCALL(ALEffect,getParamfv,(Context, param, values));
+ VCALL(ALEffect,getParamfv)(Context, param, values);
}
ALCcontext_DecRef(Context);
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index cd8f0a56..fe817c5c 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -582,7 +582,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
while(slot != slot_end)
{
if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
- VCALL((*slot)->EffectState,update,(context->Device, *slot));
+ VCALL((*slot)->EffectState,update)(context->Device, *slot);
slot++;
}