diff options
author | Chris Robinson <[email protected]> | 2009-11-25 16:21:47 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-11-25 16:21:47 -0800 |
commit | 658923175f65b5f1da182dced0b86fb32c5598cc (patch) | |
tree | 5e57af0f6c1574f3f9068e1fa8f484661f1b6fbc /OpenAL32/alAuxEffectSlot.c | |
parent | 877f4340ba509ed9b31b2de4bcbb11c1befaf3ed (diff) |
Update source parameters only when they need changing
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 700b9d28..74097d3f 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -29,6 +29,7 @@ #include "alAuxEffectSlot.h" #include "alThunk.h" #include "alError.h" +#include "alSource.h" static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, ALeffect *effect); @@ -179,6 +180,7 @@ ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot) ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue) { ALCcontext *Context; + ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; @@ -194,6 +196,7 @@ ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint { ALeffect *effect = (ALeffect*)ALTHUNK_LOOKUPENTRY(iValue); InitializeEffect(Context, ALEffectSlot, effect); + updateSources = AL_TRUE; } else alSetError(AL_INVALID_VALUE); @@ -201,7 +204,10 @@ ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(iValue == AL_TRUE || iValue == AL_FALSE) + { ALEffectSlot->AuxSendAuto = iValue; + updateSources = AL_TRUE; + } else alSetError(AL_INVALID_VALUE); break; @@ -214,6 +220,26 @@ ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint else alSetError(AL_INVALID_NAME); + // Force updating the sources that use this slot, since it affects the + // sending parameters + if(updateSources) + { + ALsource *source = Context->Source; + while(source) + { + ALuint i; + for(i = 0;i < MAX_SENDS;i++) + { + if(!source->Send[i].Slot || + source->Send[i].Slot->effectslot != effectslot) + continue; + source->NeedsUpdate = AL_TRUE; + break; + } + source = source->next; + } + } + ProcessContext(Context); } |