From 89f438df71bc757c96fd2c3660f67f5bcf684075 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 11 Sep 2011 00:58:33 -0700 Subject: [PATCH] Small fixes to setting the source's direct filter and auxiliary send --- OpenAL32/alSource.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 110b504a..879f4377 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -663,6 +663,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) if(lValue == 0 || (filter=LookupFilter(pContext->Device->FilterMap, lValue)) != NULL) { + LockContext(pContext); if(!filter) { Source->DirectGain = 1.0f; @@ -673,6 +674,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) Source->DirectGain = filter->Gain; Source->DirectGainHF = filter->GainHF; } + UnlockContext(pContext); Source->NeedsUpdate = AL_TRUE; } else @@ -784,11 +786,9 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, { /* Release refcount on the previous slot, and add one for * the new slot */ - if(Source->Send[lValue2].Slot) - DecrementRef(&Source->Send[lValue2].Slot->ref); - Source->Send[lValue2].Slot = ALEffectSlot; - if(Source->Send[lValue2].Slot) - IncrementRef(&Source->Send[lValue2].Slot->ref); + if(ALEffectSlot) IncrementRef(&ALEffectSlot->ref); + ALEffectSlot = ExchangePtr((void**)&Source->Send[lValue2].Slot, ALEffectSlot); + if(ALEffectSlot) DecrementRef(&ALEffectSlot->ref); if(!ALFilter) {