diff options
-rw-r--r-- | OpenAL32/Include/alMain.h | 12 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 75 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 62 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 138 |
4 files changed, 147 insertions, 140 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 19a57b6c..34120b00 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -379,6 +379,18 @@ void al_print(const char *fname, unsigned int line, const char *fmt, ...) ALCboolean ALCAPIENTRY alcMakeCurrent(ALCcontext *context); ALCcontext* ALCAPIENTRY alcGetThreadContext(void); +#define DECL_VERIFIER(name, type, field) \ +static type* Verify##name(type *list, ALuint id) \ +{ \ + while(list) \ + { \ + if(list->field == id) \ + break; \ + list = list->next; \ + } \ + return list; \ +} + #ifdef __cplusplus } #endif diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 650857d6..eb430c62 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -36,6 +36,7 @@ ALboolean DisabledEffects[MAX_EFFECTS]; static void InitEffectParams(ALeffect *effect, ALenum type); +DECL_VERIFIER(Effect, ALeffect, effect) ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) { @@ -99,7 +100,7 @@ ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects) // Check that all effects are valid for (i = 0; i < n; i++) { - if (!alIsEffect(effects[i])) + if(effects[i] && !VerifyEffect(device->EffectList, effects[i])) { alSetError(Context, AL_INVALID_NAME); break; @@ -112,13 +113,12 @@ ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects) for (i = 0; i < n; i++) { // Recheck that the effect is valid, because there could be duplicated names - if (effects[i] && alIsEffect(effects[i])) + if(effects[i] && + (ALEffect=VerifyEffect(device->EffectList, effects[i])) != NULL) { ALeffect **list; - ALEffect = ((ALeffect*)ALTHUNK_LOOKUPENTRY(effects[i])); - - // Remove Source from list of Sources + // Remove Effect from list of effects list = &device->EffectList; while(*list && *list != ALEffect) list = &(*list)->next; @@ -144,31 +144,31 @@ ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects) ALboolean AL_APIENTRY alIsEffect(ALuint effect) { ALCcontext *Context; - ALeffect *list; + ALboolean result; Context = GetContextSuspended(); if(!Context) return AL_FALSE; - list = Context->Device->EffectList; - while(list && list->effect != effect) - list = list->next; + result = (VerifyEffect(Context->Device->EffectList, effect) ? AL_TRUE : + AL_FALSE); ProcessContext(Context); - return ((list || !effect) ? AL_TRUE : AL_FALSE); + return result; } ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) { ALCcontext *Context; + ALCdevice *Device; + ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; - if (effect && alIsEffect(effect)) + Device = Context->Device; + if(effect && (ALEffect=VerifyEffect(Device->EffectList, effect)) != NULL) { - ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(param == AL_EFFECT_TYPE) { ALboolean isOk = (iValue == AL_EFFECT_NULL || @@ -236,14 +236,15 @@ ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues) { ALCcontext *Context; + ALCdevice *Device; + ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; - if (effect && alIsEffect(effect)) + Device = Context->Device; + if(effect && (ALEffect=VerifyEffect(Device->EffectList, effect)) != NULL) { - ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(param == AL_EFFECT_TYPE) { alEffecti(effect, param, piValues[0]); @@ -295,14 +296,15 @@ ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues) ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue) { ALCcontext *Context; + ALCdevice *Device; + ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; - if (effect && alIsEffect(effect)) + Device = Context->Device; + if(effect && (ALEffect=VerifyEffect(Device->EffectList, effect)) != NULL) { - ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(ALEffect->type == AL_EFFECT_EAXREVERB) { switch(param) @@ -632,14 +634,15 @@ ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue) ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) { ALCcontext *Context; + ALCdevice *Device; + ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; - if (effect && alIsEffect(effect)) + Device = Context->Device; + if(effect && (ALEffect=VerifyEffect(Device->EffectList, effect)) != NULL) { - ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(ALEffect->type == AL_EFFECT_EAXREVERB) { switch(param) @@ -746,14 +749,15 @@ ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue) { ALCcontext *Context; + ALCdevice *Device; + ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; - if (effect && alIsEffect(effect)) + Device = Context->Device; + if(effect && (ALEffect=VerifyEffect(Device->EffectList, effect)) != NULL) { - ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(param == AL_EFFECT_TYPE) { *piValue = ALEffect->type; @@ -805,14 +809,15 @@ ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue) ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues) { ALCcontext *Context; + ALCdevice *Device; + ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; - if (effect && alIsEffect(effect)) + Device = Context->Device; + if(effect && (ALEffect=VerifyEffect(Device->EffectList, effect)) != NULL) { - ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(param == AL_EFFECT_TYPE) { alGetEffecti(effect, param, piValues); @@ -864,14 +869,15 @@ ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues) ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue) { ALCcontext *Context; + ALCdevice *Device; + ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; - if (effect && alIsEffect(effect)) + Device = Context->Device; + if(effect && (ALEffect=VerifyEffect(Device->EffectList, effect)) != NULL) { - ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(ALEffect->type == AL_EFFECT_EAXREVERB) { switch(param) @@ -1059,14 +1065,15 @@ ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue) ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) { ALCcontext *Context; + ALCdevice *Device; + ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; - if (effect && alIsEffect(effect)) + Device = Context->Device; + if(effect && (ALEffect=VerifyEffect(Device->EffectList, effect)) != NULL) { - ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(ALEffect->type == AL_EFFECT_EAXREVERB) { switch(param) diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index d001f6a1..8b3097d3 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -32,6 +32,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type); +DECL_VERIFIER(Filter, ALfilter, filter) ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) { @@ -95,7 +96,7 @@ ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters) // Check that all filters are valid for (i = 0; i < n; i++) { - if (!alIsFilter(filters[i])) + if(!VerifyFilter(device->FilterList, filters[i])) { alSetError(Context, AL_INVALID_NAME); break; @@ -108,12 +109,11 @@ ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters) for (i = 0; i < n; i++) { // Recheck that the filter is valid, because there could be duplicated names - if (filters[i] && alIsFilter(filters[i])) + if(filters[i] && + (ALFilter=VerifyFilter(device->FilterList, filters[i])) != NULL) { ALfilter **list; - ALFilter = ((ALfilter*)ALTHUNK_LOOKUPENTRY(filters[i])); - // Remove Source from list of Sources list = &device->FilterList; while(*list && *list != ALFilter) @@ -140,31 +140,30 @@ ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters) ALboolean AL_APIENTRY alIsFilter(ALuint filter) { ALCcontext *Context; - ALfilter *list; + ALboolean result; Context = GetContextSuspended(); if(!Context) return AL_FALSE; - list = Context->Device->FilterList; - while(list && list->filter != filter) - list = list->next; - + result = (VerifyFilter(Context->Device->FilterList, filter) ? AL_TRUE : + AL_FALSE); ProcessContext(Context); - return ((list || !filter) ? AL_TRUE : AL_FALSE); + return result; } ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue) { ALCcontext *Context; + ALCdevice *Device; + ALfilter *ALFilter; Context = GetContextSuspended(); if(!Context) return; - if (filter && alIsFilter(filter)) + Device = Context->Device; + if(filter && (ALFilter=VerifyFilter(Device->FilterList, filter)) != NULL) { - ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter); - switch(param) { case AL_FILTER_TYPE: @@ -189,11 +188,13 @@ ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue) ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues) { ALCcontext *Context; + ALCdevice *Device; Context = GetContextSuspended(); if(!Context) return; - if (filter && alIsFilter(filter)) + Device = Context->Device; + if(filter && VerifyFilter(Device->FilterList, filter) != NULL) { switch(param) { @@ -215,14 +216,15 @@ ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues) ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue) { ALCcontext *Context; + ALCdevice *Device; + ALfilter *ALFilter; Context = GetContextSuspended(); if(!Context) return; - if (filter && alIsFilter(filter)) + Device = Context->Device; + if(filter && (ALFilter=VerifyFilter(Device->FilterList, filter)) != NULL) { - ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter); - switch(ALFilter->type) { case AL_FILTER_LOWPASS: @@ -262,11 +264,13 @@ ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue) ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues) { ALCcontext *Context; + ALCdevice *Device; Context = GetContextSuspended(); if(!Context) return; - if (filter && alIsFilter(filter)) + Device = Context->Device; + if(filter && VerifyFilter(Device->FilterList, filter) != NULL) { switch(param) { @@ -284,14 +288,15 @@ ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues) ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue) { ALCcontext *Context; + ALCdevice *Device; + ALfilter *ALFilter; Context = GetContextSuspended(); if(!Context) return; - if (filter && alIsFilter(filter)) + Device = Context->Device; + if(filter && (ALFilter=VerifyFilter(Device->FilterList, filter)) != NULL) { - ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter); - switch(param) { case AL_FILTER_TYPE: @@ -312,11 +317,13 @@ ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue) ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues) { ALCcontext *Context; + ALCdevice *Device; Context = GetContextSuspended(); if(!Context) return; - if (filter && alIsFilter(filter)) + Device = Context->Device; + if(filter && VerifyFilter(Device->FilterList, filter) != NULL) { switch(param) { @@ -338,14 +345,15 @@ ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues) ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue) { ALCcontext *Context; + ALCdevice *Device; + ALfilter *ALFilter; Context = GetContextSuspended(); if(!Context) return; - if (filter && alIsFilter(filter)) + Device = Context->Device; + if(filter && (ALFilter=VerifyFilter(Device->FilterList, filter)) != NULL) { - ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(filter); - switch(ALFilter->type) { case AL_FILTER_LOWPASS: @@ -379,11 +387,13 @@ ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue) ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues) { ALCcontext *Context; + ALCdevice *Device; Context = GetContextSuspended(); if(!Context) return; - if (filter && alIsFilter(filter)) + Device = Context->Device; + if(filter && VerifyFilter(Device->FilterList, filter) != NULL) { switch(param) { diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 8feea7eb..f9c3eddc 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -37,6 +37,11 @@ static ALboolean GetSourceOffset(ALsource *pSource, ALenum eName, ALfloat *pflOf static ALboolean ApplyOffset(ALsource *pSource); static ALint GetByteOffset(ALsource *pSource); +DECL_VERIFIER(Source, ALsource, source) +DECL_VERIFIER(Buffer, ALbuffer, buffer) +DECL_VERIFIER(Filter, ALfilter, filter) +DECL_VERIFIER(EffectSlot, ALeffectslot, effectslot) + ALAPI ALvoid ALAPIENTRY alGenSources(ALsizei n,ALuint *sources) { ALCcontext *Context; @@ -118,7 +123,7 @@ ALAPI ALvoid ALAPIENTRY alDeleteSources(ALsizei n, const ALuint *sources) // Check that all Sources are valid (and can therefore be deleted) for (i = 0; i < n; i++) { - if (!alIsSource(sources[i])) + if(VerifySource(Context->SourceList, sources[i]) == NULL) { alSetError(Context, AL_INVALID_NAME); bSourcesValid = AL_FALSE; @@ -132,9 +137,8 @@ ALAPI ALvoid ALAPIENTRY alDeleteSources(ALsizei n, const ALuint *sources) for(i = 0; i < n; i++) { // Recheck that the Source is valid, because there could be duplicated Source names - if(alIsSource(sources[i])) + if((ALSource=VerifySource(Context->SourceList, sources[i])) != NULL) { - ALSource = (ALsource*)ALTHUNK_LOOKUPENTRY(sources[i]); alSourceStop((ALuint)ALSource->source); // For each buffer in the source's queue, decrement its reference counter and remove it @@ -184,25 +188,13 @@ ALAPI ALvoid ALAPIENTRY alDeleteSources(ALsizei n, const ALuint *sources) ALAPI ALboolean ALAPIENTRY alIsSource(ALuint source) { - ALboolean result=AL_FALSE; ALCcontext *Context; - ALsource *Source; + ALboolean result; Context = GetContextSuspended(); if(!Context) return AL_FALSE; - // To determine if this is a valid Source name, look through the list of generated Sources - Source = Context->SourceList; - while(Source) - { - if(Source->source == source) - { - result = AL_TRUE; - break; - } - - Source = Source->next; - } + result = (VerifySource(Context->SourceList, source) ? AL_TRUE : AL_FALSE); ProcessContext(Context); @@ -218,10 +210,8 @@ ALAPI ALvoid ALAPIENTRY alSourcef(ALuint source, ALenum eParam, ALfloat flValue) pContext = GetContextSuspended(); if(!pContext) return; - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - switch(eParam) { case AL_PITCH: @@ -412,9 +402,8 @@ ALAPI ALvoid ALAPIENTRY alSource3f(ALuint source, ALenum eParam, ALfloat flValue pContext = GetContextSuspended(); if(!pContext) return; - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); switch(eParam) { case AL_POSITION: @@ -459,7 +448,7 @@ ALAPI ALvoid ALAPIENTRY alSourcefv(ALuint source, ALenum eParam, const ALfloat * if(pflValues) { - if(alIsSource(source)) + if(VerifySource(pContext->SourceList, source) != NULL) { switch(eParam) { @@ -512,9 +501,9 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) pContext = GetContextSuspended(); if(!pContext) return; - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); + ALCdevice *device = pContext->Device; switch(eParam) { @@ -546,10 +535,11 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) case AL_BUFFER: if(pSource->state == AL_STOPPED || pSource->state == AL_INITIAL) { - if(alIsBuffer(lValue)) - { - ALbuffer *buffer = NULL; + ALbuffer *buffer = NULL; + if(lValue == 0 || + (buffer=VerifyBuffer(device->BufferList, lValue)) != NULL) + { // Remove all elements in the queue while(pSource->queue != NULL) { @@ -567,8 +557,6 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) // Add the buffer to the queue (as long as it is NOT the NULL buffer) if(lValue != 0) { - buffer = (ALbuffer*)ALTHUNK_LOOKUPENTRY(lValue); - // Source is now in STATIC mode pSource->lSourceType = AL_STATIC; @@ -629,10 +617,12 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) alSetError(pContext, AL_INVALID_VALUE); break; - case AL_DIRECT_FILTER: - if(alIsFilter(lValue)) + case AL_DIRECT_FILTER: { + ALfilter *filter = NULL; + + if(lValue == 0 || + (filter=VerifyFilter(pContext->Device->FilterList, lValue)) != NULL) { - ALfilter *filter = (ALfilter*)ALTHUNK_LOOKUPENTRY(lValue); if(!filter) { pSource->DirectFilter.type = AL_FILTER_NULL; @@ -644,7 +634,7 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) } else alSetError(pContext, AL_INVALID_VALUE); - break; + } break; case AL_DIRECT_FILTER_GAINHF_AUTO: if(lValue == AL_TRUE || lValue == AL_FALSE) @@ -707,15 +697,15 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) ALAPI void ALAPIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, ALint lValue2, ALint lValue3) { - ALCcontext *pContext; + ALCcontext *pContext; + ALsource *pSource; pContext = GetContextSuspended(); if(!pContext) return; - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - ALsource *pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - ALCdevice *Device = pContext->Device; + ALCdevice *device = pContext->Device; switch (eParam) { @@ -725,14 +715,16 @@ ALAPI void ALAPIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, AL alSource3f(source, eParam, (ALfloat)lValue1, (ALfloat)lValue2, (ALfloat)lValue3); break; - case AL_AUXILIARY_SEND_FILTER: - if((ALuint)lValue2 < Device->NumAuxSends && - (lValue1 == 0 || alIsAuxiliaryEffectSlot(lValue1)) && - alIsFilter(lValue3)) - { - ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(lValue1); - ALfilter *ALFilter = (ALfilter*)ALTHUNK_LOOKUPENTRY(lValue3); + case AL_AUXILIARY_SEND_FILTER: { + ALeffectslot *ALEffectSlot = NULL; + ALfilter *ALFilter = NULL; + if((ALuint)lValue2 < device->NumAuxSends && + (lValue1 == 0 || + (ALEffectSlot=VerifyEffectSlot(pContext->EffectSlotList, lValue1)) != NULL) && + (lValue3 == 0 || + (ALFilter=VerifyFilter(device->FilterList, lValue3)) != NULL)) + { /* Release refcount on the previous slot, and add one for * the new slot */ if(pSource->Send[lValue2].Slot) @@ -753,7 +745,7 @@ ALAPI void ALAPIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, AL } else alSetError(pContext, AL_INVALID_VALUE); - break; + } break; default: alSetError(pContext, AL_INVALID_ENUM); @@ -776,7 +768,7 @@ ALAPI void ALAPIENTRY alSourceiv(ALuint source, ALenum eParam, const ALint* plVa if(plValues) { - if(alIsSource(source)) + if(VerifySource(pContext->SourceList, source) != NULL) { switch(eParam) { @@ -834,10 +826,8 @@ ALAPI ALvoid ALAPIENTRY alGetSourcef(ALuint source, ALenum eParam, ALfloat *pflV if(pflValue) { - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - switch(eParam) { case AL_PITCH: @@ -932,10 +922,8 @@ ALAPI ALvoid ALAPIENTRY alGetSource3f(ALuint source, ALenum eParam, ALfloat* pfl if(pflValue1 && pflValue2 && pflValue3) { - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - switch(eParam) { case AL_POSITION: @@ -983,10 +971,8 @@ ALAPI ALvoid ALAPIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *pfl if(pflValues) { - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - switch(eParam) { case AL_PITCH: @@ -1067,10 +1053,8 @@ ALAPI ALvoid ALAPIENTRY alGetSourcei(ALuint source, ALenum eParam, ALint *plValu if(plValue) { - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - switch(eParam) { case AL_MAX_DISTANCE: @@ -1188,10 +1172,8 @@ ALAPI void ALAPIENTRY alGetSource3i(ALuint source, ALenum eParam, ALint* plValue if(plValue1 && plValue2 && plValue3) { - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - switch(eParam) { case AL_POSITION: @@ -1239,10 +1221,8 @@ ALAPI void ALAPIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plValue if(plValues) { - if(alIsSource(source)) + if((pSource=VerifySource(pContext->SourceList, source)) != NULL) { - pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - switch(eParam) { case AL_SOURCE_RELATIVE: @@ -1337,7 +1317,7 @@ ALAPI ALvoid ALAPIENTRY alSourcePlayv(ALsizei n, const ALuint *pSourceList) // Check that all the Sources are valid for(i = 0; i < n; i++) { - if(!alIsSource(pSourceList[i])) + if(!VerifySource(pContext->SourceList, pSourceList[i])) { alSetError(pContext, AL_INVALID_NAME); bSourcesValid = AL_FALSE; @@ -1438,7 +1418,7 @@ ALAPI ALvoid ALAPIENTRY alSourcePausev(ALsizei n, const ALuint *sources) // Check all the Sources are valid for(i=0;i<n;i++) { - if(!alIsSource(sources[i])) + if(!VerifySource(Context->SourceList, sources[i])) { alSetError(Context, AL_INVALID_NAME); bSourcesValid = AL_FALSE; @@ -1485,7 +1465,7 @@ ALAPI ALvoid ALAPIENTRY alSourceStopv(ALsizei n, const ALuint *sources) // Check all the Sources are valid for(i = 0;i < n;i++) { - if(!alIsSource(sources[i])) + if(!VerifySource(Context->SourceList, sources[i])) { alSetError(Context, AL_INVALID_NAME); bSourcesValid = AL_FALSE; @@ -1536,7 +1516,7 @@ ALAPI ALvoid ALAPIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) // Check all the Sources are valid for(i = 0;i < n;i++) { - if(!alIsSource(sources[i])) + if(!VerifySource(Context->SourceList, sources[i])) { alSetError(Context, AL_INVALID_NAME); bSourcesValid = AL_FALSE; @@ -1593,13 +1573,13 @@ ALAPI ALvoid ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, const AL // Check that all buffers are valid or zero and that the source is valid // Check that this is a valid source - if(alIsSource(source)) + if((ALSource=VerifySource(Context->SourceList, source)) != NULL) { - ALSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - // Check that this is not a STATIC Source if(ALSource->lSourceType != AL_STATIC) { + ALCdevice *device = Context->Device; + iFrequency = -1; iFormat = -1; @@ -1621,16 +1601,16 @@ ALAPI ALvoid ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, const AL { ALbuffer *buffer; - if(!alIsBuffer(buffers[i])) + if(!buffers[i]) + continue; + + if((buffer=VerifyBuffer(device->BufferList, buffers[i])) == NULL) { alSetError(Context, AL_INVALID_NAME); bBuffersValid = AL_FALSE; break; } - if(!buffers[i]) - continue; - buffer = (ALbuffer*)ALTHUNK_LOOKUPENTRY(buffers[i]); if(iFrequency == -1 && iFormat == -1) { iFrequency = buffer->frequency; @@ -1647,7 +1627,7 @@ ALAPI ALvoid ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, const AL if(bBuffersValid) { - ALbuffer *buffer = NULL; + ALbuffer *buffer; // Change Source Type ALSource->lSourceType = AL_STREAMING; @@ -1736,10 +1716,8 @@ ALAPI ALvoid ALAPIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALuint Context = GetContextSuspended(); if(!Context) return; - if(alIsSource(source)) + if((ALSource=VerifySource(Context->SourceList, source)) != NULL) { - ALSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source); - // If all 'n' buffers have been processed, remove them from the queue if(!ALSource->bLooping && (ALuint)n <= ALSource->BuffersPlayed) { |