aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alAuxEffectSlot.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-07-16 02:41:02 -0700
committerChris Robinson <[email protected]>2011-07-16 02:41:02 -0700
commitda2429a1d0ad184abe24f61aa7e064b81026651c (patch)
tree0f11fd679964b02b318a9e556e3051c9c91b5aad /OpenAL32/alAuxEffectSlot.c
parent54b5f35125d1b85c3e16c292a9829e9d652d2e38 (diff)
Allow effect slots to be updated asynchronously
Updates when the slot changes effect type is still sychronous, however, to ensure a proper state for the Process method call. Fixing this would essentially require all effects to work from the same state.
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r--OpenAL32/alAuxEffectSlot.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 09e29f1e..b4046c71 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -86,6 +86,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
slot->Gain = 1.0;
slot->AuxSendAuto = AL_TRUE;
+ slot->NeedsUpdate = AL_FALSE;
for(j = 0;j < BUFFERSIZE;j++)
slot->WetBuffer[j] = 0.0f;
for(j = 0;j < 1;j++)
@@ -495,12 +496,26 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, AL
if(EffectSlot->EffectState)
ALEffect_Destroy(EffectSlot->EffectState);
EffectSlot->EffectState = NewState;
+
+ if(!effect)
+ memset(&EffectSlot->effect, 0, sizeof(EffectSlot->effect));
+ else
+ memcpy(&EffectSlot->effect, effect, sizeof(*effect));
+ /* FIXME: This should be done asychronously, but since the EfefctState
+ * object was changed, it needs an update before its Process method can
+ * be called (coming changes may not guarantee an update when the
+ * NeedsUpdate flag is set). */
+ EffectSlot->NeedsUpdate = AL_FALSE;
+ ALEffect_Update(EffectSlot->EffectState, Context, &EffectSlot->effect);
}
- if(!effect)
- memset(&EffectSlot->effect, 0, sizeof(EffectSlot->effect));
else
- memcpy(&EffectSlot->effect, effect, sizeof(*effect));
- ALEffect_Update(EffectSlot->EffectState, Context, &EffectSlot->effect);
+ {
+ if(!effect)
+ memset(&EffectSlot->effect, 0, sizeof(EffectSlot->effect));
+ else
+ memcpy(&EffectSlot->effect, effect, sizeof(*effect));
+ EffectSlot->NeedsUpdate = AL_TRUE;
+ }
}