aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h13
-rw-r--r--OpenAL32/alAuxEffectSlot.c28
-rw-r--r--OpenAL32/alBuffer.c43
-rw-r--r--OpenAL32/alEffect.c24
-rw-r--r--OpenAL32/alFilter.c24
-rw-r--r--OpenAL32/alSource.c69
6 files changed, 97 insertions, 104 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 10a7c957..9615ec8b 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -667,6 +667,14 @@ struct ALCdevice_struct
// Specifies if the device is currently running
#define DEVICE_RUNNING (1<<31)
+#define LookupBuffer(m, k) ((struct ALbuffer*)LookupUIntMapKey(&(m)->BufferMap, (k)))
+#define LookupEffect(m, k) ((struct ALeffect*)LookupUIntMapKey(&(m)->EffectMap, (k)))
+#define LookupFilter(m, k) ((struct ALfilter*)LookupUIntMapKey(&(m)->FilterMap, (k)))
+#define RemoveBuffer(m, k) ((struct ALbuffer*)PopUIntMapValue(&(m)->BufferMap, (k)))
+#define RemoveEffect(m, k) ((struct ALeffect*)PopUIntMapValue(&(m)->EffectMap, (k)))
+#define RemoveFilter(m, k) ((struct ALfilter*)PopUIntMapValue(&(m)->FilterMap, (k)))
+
+
struct ALCcontext_struct
{
volatile RefCount ref;
@@ -702,6 +710,11 @@ struct ALCcontext_struct
ALCcontext *volatile next;
};
+#define LookupSource(m, k) ((struct ALsource*)LookupUIntMapKey(&(m)->SourceMap, (k)))
+#define LookupEffectSlot(m, k) ((struct ALeffectslot*)LookupUIntMapKey(&(m)->EffectSlotMap, (k)))
+#define RemoveSource(m, k) ((struct ALsource*)PopUIntMapValue(&(m)->SourceMap, (k)))
+#define RemoveEffectSlot(m, k) ((struct ALeffectslot*)PopUIntMapValue(&(m)->EffectSlotMap, (k)))
+
ALCcontext *GetContextRef(void);
void ALCcontext_IncRef(ALCcontext *context);
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 0af70681..42dd20cb 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -36,9 +36,6 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, AL
static ALenum ResizeEffectSlotArray(ALCcontext *Context, ALsizei count);
static ALvoid RemoveEffectSlotArray(ALCcontext *Context, ALeffectslot *val);
-#define LookupEffectSlot(m, k) ((ALeffectslot*)LookupUIntMapKey(&(m), (k)))
-#define RemoveEffectSlot(m, k) ((ALeffectslot*)PopUIntMapValue(&(m), (k)))
-#define LookupEffect(m, k) ((ALeffect*)LookupUIntMapKey(&(m), (k)))
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
{
@@ -131,7 +128,7 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *
// Check that all effectslots are valid
for(i = 0;i < n;i++)
{
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) == NULL)
+ if((EffectSlot=LookupEffectSlot(Context, effectslots[i])) == NULL)
{
alSetError(Context, AL_INVALID_NAME);
n = 0;
@@ -149,7 +146,7 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *
for(i = 0;i < n;i++)
{
// Recheck that the effectslot is valid, because there could be duplicated names
- if((EffectSlot=RemoveEffectSlot(Context->EffectSlotMap, effectslots[i])) == NULL)
+ if((EffectSlot=RemoveEffectSlot(Context, effectslots[i])) == NULL)
continue;
FreeThunkEntry(EffectSlot->effectslot);
@@ -172,8 +169,7 @@ AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot)
Context = GetContextRef();
if(!Context) return AL_FALSE;
- result = (LookupEffectSlot(Context->EffectSlotMap, effectslot) ?
- AL_TRUE : AL_FALSE);
+ result = (LookupEffectSlot(Context, effectslot) ? AL_TRUE : AL_FALSE);
ALCcontext_DecRef(Context);
@@ -190,7 +186,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
if(!Context) return;
Device = Context->Device;
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL)
+ if((EffectSlot=LookupEffectSlot(Context, effectslot)) != NULL)
{
switch(param)
{
@@ -198,7 +194,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
ALeffect *effect = NULL;
if(iValue == 0 ||
- (effect=LookupEffect(Device->EffectMap, iValue)) != NULL)
+ (effect=LookupEffect(Device, iValue)) != NULL)
{
InitializeEffect(Context, EffectSlot, effect);
Context->UpdateSources = AL_TRUE;
@@ -243,7 +239,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para
Context = GetContextRef();
if(!Context) return;
- if(LookupEffectSlot(Context->EffectSlotMap, effectslot) != NULL)
+ if(LookupEffectSlot(Context, effectslot) != NULL)
{
switch(param)
{
@@ -266,7 +262,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param
Context = GetContextRef();
if(!Context) return;
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL)
+ if((EffectSlot=LookupEffectSlot(Context, effectslot)) != NULL)
{
switch(param)
{
@@ -305,7 +301,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum para
Context = GetContextRef();
if(!Context) return;
- if(LookupEffectSlot(Context->EffectSlotMap, effectslot) != NULL)
+ if(LookupEffectSlot(Context, effectslot) != NULL)
{
switch(param)
{
@@ -328,7 +324,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa
Context = GetContextRef();
if(!Context) return;
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL)
+ if((EffectSlot=LookupEffectSlot(Context, effectslot)) != NULL)
{
switch(param)
{
@@ -366,7 +362,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p
Context = GetContextRef();
if(!Context) return;
- if(LookupEffectSlot(Context->EffectSlotMap, effectslot) != NULL)
+ if(LookupEffectSlot(Context, effectslot) != NULL)
{
switch(param)
{
@@ -389,7 +385,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa
Context = GetContextRef();
if(!Context) return;
- if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL)
+ if((EffectSlot=LookupEffectSlot(Context, effectslot)) != NULL)
{
switch(param)
{
@@ -422,7 +418,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p
Context = GetContextRef();
if(!Context) return;
- if(LookupEffectSlot(Context->EffectSlotMap, effectslot) != NULL)
+ if(LookupEffectSlot(Context, effectslot) != NULL)
{
switch(param)
{
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 3740cb60..d6d34c67 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -40,9 +40,6 @@ static ALboolean IsValidChannels(ALenum channels);
static ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, enum UserFmtType *type);
static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type);
-#define LookupBuffer(m, k) ((ALbuffer*)LookupUIntMapKey(&(m), (k)))
-#define RemoveBuffer(m, k) ((ALbuffer*)PopUIntMapValue(&(m), (k)))
-
/*
* Global Variables
@@ -217,7 +214,7 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers)
continue;
/* Check for valid Buffer ID */
- if((ALBuf=LookupBuffer(device->BufferMap, buffers[i])) == NULL)
+ if((ALBuf=LookupBuffer(device, buffers[i])) == NULL)
{
alSetError(Context, AL_INVALID_NAME);
n = 0;
@@ -234,7 +231,7 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers)
for(i = 0;i < n;i++)
{
- if((ALBuf=RemoveBuffer(device->BufferMap, buffers[i])) == NULL)
+ if((ALBuf=RemoveBuffer(device, buffers[i])) == NULL)
continue;
FreeThunkEntry(ALBuf->buffer);
@@ -263,7 +260,7 @@ AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer)
Context = GetContextRef();
if(!Context) return AL_FALSE;
- result = ((!buffer || LookupBuffer(Context->Device->BufferMap, buffer)) ?
+ result = ((!buffer || LookupBuffer(Context->Device, buffer)) ?
AL_TRUE : AL_FALSE);
ALCcontext_DecRef(Context);
@@ -290,7 +287,7 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid
if(!Context) return;
device = Context->Device;
- if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
+ if((ALBuf=LookupBuffer(device, buffer)) == NULL)
alSetError(Context, AL_INVALID_NAME);
else if(size < 0 || freq < 0)
alSetError(Context, AL_INVALID_VALUE);
@@ -390,7 +387,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const
if(!Context) return;
device = Context->Device;
- if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
+ if((ALBuf=LookupBuffer(device, buffer)) == NULL)
alSetError(Context, AL_INVALID_NAME);
else if(length < 0 || offset < 0 || (length > 0 && data == NULL))
alSetError(Context, AL_INVALID_VALUE);
@@ -449,7 +446,7 @@ AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer,
if(!Context) return;
device = Context->Device;
- if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
+ if((ALBuf=LookupBuffer(device, buffer)) == NULL)
alSetError(Context, AL_INVALID_NAME);
else if(frames < 0 || samplerate == 0)
alSetError(Context, AL_INVALID_VALUE);
@@ -485,7 +482,7 @@ AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer,
if(!Context) return;
device = Context->Device;
- if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
+ if((ALBuf=LookupBuffer(device, buffer)) == NULL)
alSetError(Context, AL_INVALID_NAME);
else if(frames < 0 || offset < 0 || (frames > 0 && data == NULL))
alSetError(Context, AL_INVALID_VALUE);
@@ -533,7 +530,7 @@ AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer,
if(!Context) return;
device = Context->Device;
- if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
+ if((ALBuf=LookupBuffer(device, buffer)) == NULL)
alSetError(Context, AL_INVALID_NAME);
else if(frames < 0 || offset < 0 || (frames > 0 && data == NULL))
alSetError(Context, AL_INVALID_VALUE);
@@ -598,7 +595,7 @@ AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum eParam, ALfloat flValue)
if(!pContext) return;
device = pContext->Device;
- if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -627,7 +624,7 @@ AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum eParam, ALfloat flValue
if(!pContext) return;
device = pContext->Device;
- if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -654,7 +651,7 @@ AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum eParam, const ALfloat*
device = pContext->Device;
if(!flValues)
alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ else if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -681,7 +678,7 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum eParam, ALint lValue)
if(!pContext) return;
device = pContext->Device;
- if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -710,7 +707,7 @@ AL_API void AL_APIENTRY alBuffer3i( ALuint buffer, ALenum eParam, ALint lValue1,
if(!pContext) return;
device = pContext->Device;
- if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -738,7 +735,7 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum eParam, const ALint* pl
device = pContext->Device;
if(!plValues)
alSetError(pContext, AL_INVALID_VALUE);
- else if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
+ else if((ALBuf=LookupBuffer(device, buffer)) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -787,7 +784,7 @@ AL_API ALvoid AL_APIENTRY alGetBufferf(ALuint buffer, ALenum eParam, ALfloat *pf
device = pContext->Device;
if(!pflValue)
alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ else if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -814,7 +811,7 @@ AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum eParam, ALfloat* pfl
device = pContext->Device;
if(!pflValue1 || !pflValue2 || !pflValue3)
alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ else if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -841,7 +838,7 @@ AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum eParam, ALfloat* pfl
device = pContext->Device;
if(!pflValues)
alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ else if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -869,7 +866,7 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum eParam, ALint *plVa
device = pContext->Device;
if(!plValue)
alSetError(pContext, AL_INVALID_VALUE);
- else if((pBuffer=LookupBuffer(device->BufferMap, buffer)) == NULL)
+ else if((pBuffer=LookupBuffer(device, buffer)) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -912,7 +909,7 @@ AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum eParam, ALint* plVal
device = pContext->Device;
if(!plValue1 || !plValue2 || !plValue3)
alSetError(pContext, AL_INVALID_VALUE);
- else if(LookupBuffer(device->BufferMap, buffer) == NULL)
+ else if(LookupBuffer(device, buffer) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
@@ -950,7 +947,7 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum eParam, ALint* plVal
device = pContext->Device;
if(!plValues)
alSetError(pContext, AL_INVALID_VALUE);
- else if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL)
+ else if((ALBuf=LookupBuffer(device, buffer)) == NULL)
alSetError(pContext, AL_INVALID_NAME);
else
{
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index d9e38069..11212009 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -36,8 +36,6 @@ ALboolean DisabledEffects[MAX_EFFECTS];
static void InitEffectParams(ALeffect *effect, ALenum type);
-#define LookupEffect(m, k) ((ALeffect*)LookupUIntMapKey(&(m), (k)))
-#define RemoveEffect(m, k) ((ALeffect*)PopUIntMapValue(&(m), (k)))
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
{
@@ -107,7 +105,7 @@ AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects)
if(!effects[i])
continue;
- if(LookupEffect(device->EffectMap, effects[i]) == NULL)
+ if(LookupEffect(device, effects[i]) == NULL)
{
alSetError(Context, AL_INVALID_NAME);
n = 0;
@@ -118,7 +116,7 @@ AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects)
for(i = 0;i < n;i++)
{
// Recheck that the effect is valid, because there could be duplicated names
- if((ALEffect=RemoveEffect(device->EffectMap, effects[i])) == NULL)
+ if((ALEffect=RemoveEffect(device, effects[i])) == NULL)
continue;
FreeThunkEntry(ALEffect->effect);
@@ -138,7 +136,7 @@ AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect)
Context = GetContextRef();
if(!Context) return AL_FALSE;
- result = ((!effect || LookupEffect(Context->Device->EffectMap, effect)) ?
+ result = ((!effect || LookupEffect(Context->Device, effect)) ?
AL_TRUE : AL_FALSE);
ALCcontext_DecRef(Context);
@@ -156,7 +154,7 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue)
if(!Context) return;
Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
+ if((ALEffect=LookupEffect(Device, effect)) != NULL)
{
if(param == AL_EFFECT_TYPE)
{
@@ -196,7 +194,7 @@ AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *p
if(!Context) return;
Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
+ if((ALEffect=LookupEffect(Device, effect)) != NULL)
{
/* Call the appropriate handler */
ALeffect_SetParamiv(ALEffect, Context, param, piValues);
@@ -217,7 +215,7 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue
if(!Context) return;
Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
+ if((ALEffect=LookupEffect(Device, effect)) != NULL)
{
/* Call the appropriate handler */
ALeffect_SetParamf(ALEffect, Context, param, flValue);
@@ -238,7 +236,7 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat
if(!Context) return;
Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
+ if((ALEffect=LookupEffect(Device, effect)) != NULL)
{
/* Call the appropriate handler */
ALeffect_SetParamfv(ALEffect, Context, param, pflValues);
@@ -259,7 +257,7 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piVal
if(!Context) return;
Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
+ if((ALEffect=LookupEffect(Device, effect)) != NULL)
{
if(param == AL_EFFECT_TYPE)
{
@@ -287,7 +285,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piVa
if(!Context) return;
Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
+ if((ALEffect=LookupEffect(Device, effect)) != NULL)
{
/* Call the appropriate handler */
ALeffect_GetParamiv(ALEffect, Context, param, piValues);
@@ -308,7 +306,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pfl
if(!Context) return;
Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
+ if((ALEffect=LookupEffect(Device, effect)) != NULL)
{
/* Call the appropriate handler */
ALeffect_GetParamf(ALEffect, Context, param, pflValue);
@@ -329,7 +327,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pf
if(!Context) return;
Device = Context->Device;
- if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL)
+ if((ALEffect=LookupEffect(Device, effect)) != NULL)
{
/* Call the appropriate handler */
ALeffect_GetParamfv(ALEffect, Context, param, pflValues);
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c
index adf689ca..07cc1ea3 100644
--- a/OpenAL32/alFilter.c
+++ b/OpenAL32/alFilter.c
@@ -32,8 +32,6 @@
static void InitFilterParams(ALfilter *filter, ALenum type);
-#define LookupFilter(m, k) ((ALfilter*)LookupUIntMapKey(&(m), (k)))
-#define RemoveFilter(m, k) ((ALfilter*)PopUIntMapValue(&(m), (k)))
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
{
@@ -103,7 +101,7 @@ AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters)
if(!filters[i])
continue;
- if(LookupFilter(device->FilterMap, filters[i]) == NULL)
+ if(LookupFilter(device, filters[i]) == NULL)
{
alSetError(Context, AL_INVALID_NAME);
n = 0;
@@ -114,7 +112,7 @@ AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters)
for(i = 0;i < n;i++)
{
// Recheck that the filter is valid, because there could be duplicated names
- if((ALFilter=RemoveFilter(device->FilterMap, filters[i])) == NULL)
+ if((ALFilter=RemoveFilter(device, filters[i])) == NULL)
continue;
FreeThunkEntry(ALFilter->filter);
@@ -134,7 +132,7 @@ AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter)
Context = GetContextRef();
if(!Context) return AL_FALSE;
- result = ((!filter || LookupFilter(Context->Device->FilterMap, filter)) ?
+ result = ((!filter || LookupFilter(Context->Device, filter)) ?
AL_TRUE : AL_FALSE);
ALCcontext_DecRef(Context);
@@ -152,7 +150,7 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue)
if(!Context) return;
Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
+ if((ALFilter=LookupFilter(Device, filter)) != NULL)
{
switch(param)
{
@@ -192,7 +190,7 @@ AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *p
if(!Context) return;
Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
+ if((ALFilter=LookupFilter(Device, filter)) != NULL)
{
/* Call the appropriate handler */
ALfilter_SetParamiv(ALFilter, Context, param, piValues);
@@ -213,7 +211,7 @@ AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue
if(!Context) return;
Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
+ if((ALFilter=LookupFilter(Device, filter)) != NULL)
{
/* Call the appropriate handler */
ALfilter_SetParamf(ALFilter, Context, param, flValue);
@@ -234,7 +232,7 @@ AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat
if(!Context) return;
Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
+ if((ALFilter=LookupFilter(Device, filter)) != NULL)
{
/* Call the appropriate handler */
ALfilter_SetParamfv(ALFilter, Context, param, pflValues);
@@ -255,7 +253,7 @@ AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piVal
if(!Context) return;
Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
+ if((ALFilter=LookupFilter(Device, filter)) != NULL)
{
switch(param)
{
@@ -292,7 +290,7 @@ AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piVa
if(!Context) return;
Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
+ if((ALFilter=LookupFilter(Device, filter)) != NULL)
{
/* Call the appropriate handler */
ALfilter_GetParamiv(ALFilter, Context, param, piValues);
@@ -313,7 +311,7 @@ AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pfl
if(!Context) return;
Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
+ if((ALFilter=LookupFilter(Device, filter)) != NULL)
{
/* Call the appropriate handler */
ALfilter_GetParamf(ALFilter, Context, param, pflValue);
@@ -334,7 +332,7 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pf
if(!Context) return;
Device = Context->Device;
- if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
+ if((ALFilter=LookupFilter(Device, filter)) != NULL)
{
/* Call the appropriate handler */
ALfilter_GetParamfv(ALFilter, Context, param, pflValues);
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 4941bc65..80c5a91b 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -50,11 +50,6 @@ static ALvoid InitSourceParams(ALsource *Source);
static ALvoid GetSourceOffset(ALsource *Source, ALenum eName, ALdouble *Offsets, ALdouble updateLen);
static ALint GetByteOffset(ALsource *Source);
-#define LookupSource(m, k) ((ALsource*)LookupUIntMapKey(&(m), (k)))
-#define RemoveSource(m, k) ((ALsource*)PopUIntMapValue(&(m), (k)))
-#define LookupBuffer(m, k) ((ALbuffer*)LookupUIntMapKey(&(m), (k)))
-#define LookupFilter(m, k) ((ALfilter*)LookupUIntMapKey(&(m), (k)))
-#define LookupEffectSlot(m, k) ((ALeffectslot*)LookupUIntMapKey(&(m), (k)))
AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n,ALuint *sources)
{
@@ -124,7 +119,7 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
// Check that all Sources are valid (and can therefore be deleted)
for(i = 0;i < n;i++)
{
- if(LookupSource(Context->SourceMap, sources[i]) == NULL)
+ if(LookupSource(Context, sources[i]) == NULL)
{
alSetError(Context, AL_INVALID_NAME);
n = 0;
@@ -138,7 +133,7 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
ALsource **srclist, **srclistend;
// Remove Source from list of Sources
- if((Source=RemoveSource(Context->SourceMap, sources[i])) == NULL)
+ if((Source=RemoveSource(Context, sources[i])) == NULL)
continue;
FreeThunkEntry(Source->source);
@@ -193,7 +188,7 @@ AL_API ALboolean AL_APIENTRY alIsSource(ALuint source)
Context = GetContextRef();
if(!Context) return AL_FALSE;
- result = (LookupSource(Context->SourceMap, source) ? AL_TRUE : AL_FALSE);
+ result = (LookupSource(Context, source) ? AL_TRUE : AL_FALSE);
ALCcontext_DecRef(Context);
@@ -209,7 +204,7 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum eParam, ALfloat flValu
pContext = GetContextRef();
if(!pContext) return;
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
switch(eParam)
{
@@ -402,7 +397,7 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum eParam, ALfloat flVal
pContext = GetContextRef();
if(!pContext) return;
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
switch(eParam)
{
@@ -500,7 +495,7 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum eParam, const ALfloat
if(pflValues)
{
- if(LookupSource(pContext->SourceMap, source) != NULL)
+ if(LookupSource(pContext, source) != NULL)
{
switch(eParam)
{
@@ -539,7 +534,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
pContext = GetContextRef();
if(!pContext) return;
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
ALCdevice *device = pContext->Device;
@@ -569,8 +564,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
ALbufferlistitem *oldlist;
ALbuffer *buffer = NULL;
- if(lValue == 0 ||
- (buffer=LookupBuffer(device->BufferMap, lValue)) != NULL)
+ if(lValue == 0 || (buffer=LookupBuffer(device, lValue)) != NULL)
{
Source->BuffersInQueue = 0;
Source->BuffersPlayed = 0;
@@ -662,8 +656,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
case AL_DIRECT_FILTER: {
ALfilter *filter = NULL;
- if(lValue == 0 ||
- (filter=LookupFilter(pContext->Device->FilterMap, lValue)) != NULL)
+ if(lValue == 0 || (filter=LookupFilter(pContext->Device, lValue)) != NULL)
{
LockContext(pContext);
if(!filter)
@@ -769,7 +762,7 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1,
pContext = GetContextRef();
if(!pContext) return;
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
ALCdevice *device = pContext->Device;
@@ -781,10 +774,8 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1,
LockContext(pContext);
if((ALuint)lValue2 < device->NumAuxSends &&
- (lValue1 == 0 ||
- (ALEffectSlot=LookupEffectSlot(pContext->EffectSlotMap, lValue1)) != NULL) &&
- (lValue3 == 0 ||
- (ALFilter=LookupFilter(device->FilterMap, lValue3)) != NULL))
+ (lValue1 == 0 || (ALEffectSlot=LookupEffectSlot(pContext, lValue1)) != NULL) &&
+ (lValue3 == 0 || (ALFilter=LookupFilter(device, lValue3)) != NULL))
{
/* Release refcount on the previous slot, and add one for
* the new slot */
@@ -865,7 +856,7 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* pl
if(plValues)
{
- if(LookupSource(pContext->SourceMap, source) != NULL)
+ if(LookupSource(pContext, source) != NULL)
{
switch(eParam)
{
@@ -896,7 +887,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum eParam, ALfloat *pf
if(pflValue)
{
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
switch(eParam)
{
@@ -992,7 +983,7 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum eParam, ALfloat* p
if(pflValue1 && pflValue2 && pflValue3)
{
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
switch(eParam)
{
@@ -1076,7 +1067,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *p
if(pflValues)
{
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
switch(eParam)
{
@@ -1119,7 +1110,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plVa
if(plValue)
{
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
switch(eParam)
{
@@ -1253,7 +1244,7 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum eParam, ALint* plVal
if(plValue1 && plValue2 && plValue3)
{
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
switch(eParam)
{
@@ -1342,7 +1333,7 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plVal
if(plValues)
{
- if((Source=LookupSource(pContext->SourceMap, source)) != NULL)
+ if((Source=LookupSource(pContext, source)) != NULL)
{
switch(eParam)
{
@@ -1400,7 +1391,7 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
// Check that all the Sources are valid
for(i = 0;i < n;i++)
{
- if(!LookupSource(Context->SourceMap, sources[i]))
+ if(!LookupSource(Context, sources[i]))
{
alSetError(Context, AL_INVALID_NAME);
goto done;
@@ -1430,7 +1421,7 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
for(i = 0;i < n;i++)
{
- Source = LookupSource(Context->SourceMap, sources[i]);
+ Source = LookupSource(Context, sources[i]);
if(Context->DeferUpdates) Source->new_state = AL_PLAYING;
else SetSourceState(Source, Context, AL_PLAYING);
}
@@ -1468,7 +1459,7 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources)
// Check all the Sources are valid
for(i = 0;i < n;i++)
{
- if(!LookupSource(Context->SourceMap, sources[i]))
+ if(!LookupSource(Context, sources[i]))
{
alSetError(Context, AL_INVALID_NAME);
goto done;
@@ -1478,7 +1469,7 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources)
LockContext(Context);
for(i = 0;i < n;i++)
{
- Source = LookupSource(Context->SourceMap, sources[i]);
+ Source = LookupSource(Context, sources[i]);
if(Context->DeferUpdates) Source->new_state = AL_PAUSED;
else SetSourceState(Source, Context, AL_PAUSED);
}
@@ -1516,7 +1507,7 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources)
// Check all the Sources are valid
for(i = 0;i < n;i++)
{
- if(!LookupSource(Context->SourceMap, sources[i]))
+ if(!LookupSource(Context, sources[i]))
{
alSetError(Context, AL_INVALID_NAME);
goto done;
@@ -1526,7 +1517,7 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources)
LockContext(Context);
for(i = 0;i < n;i++)
{
- Source = LookupSource(Context->SourceMap, sources[i]);
+ Source = LookupSource(Context, sources[i]);
Source->new_state = AL_NONE;
SetSourceState(Source, Context, AL_STOPPED);
}
@@ -1564,7 +1555,7 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources)
// Check all the Sources are valid
for(i = 0;i < n;i++)
{
- if(!LookupSource(Context->SourceMap, sources[i]))
+ if(!LookupSource(Context, sources[i]))
{
alSetError(Context, AL_INVALID_NAME);
goto done;
@@ -1574,7 +1565,7 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources)
LockContext(Context);
for(i = 0;i < n;i++)
{
- Source = LookupSource(Context->SourceMap, sources[i]);
+ Source = LookupSource(Context, sources[i]);
Source->new_state = AL_NONE;
SetSourceState(Source, Context, AL_INITIAL);
}
@@ -1610,7 +1601,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
// Check that all buffers are valid or zero and that the source is valid
// Check that this is a valid source
- if((Source=LookupSource(Context->SourceMap, source)) == NULL)
+ if((Source=LookupSource(Context, source)) == NULL)
{
alSetError(Context, AL_INVALID_NAME);
goto error;
@@ -1645,7 +1636,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
for(i = 0;i < n;i++)
{
ALbuffer *buffer = NULL;
- if(buffers[i] && (buffer=LookupBuffer(device->BufferMap, buffers[i])) == NULL)
+ if(buffers[i] && (buffer=LookupBuffer(device, buffers[i])) == NULL)
{
UnlockContext(Context);
alSetError(Context, AL_INVALID_NAME);
@@ -1756,7 +1747,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALui
goto done;
}
- if((Source=LookupSource(Context->SourceMap, source)) == NULL)
+ if((Source=LookupSource(Context, source)) == NULL)
{
alSetError(Context, AL_INVALID_NAME);
goto done;