aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alAuxEffectSlot.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r--OpenAL32/alAuxEffectSlot.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 1407e1b1..368a0fb1 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -195,12 +195,12 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
if(!(value == AL_TRUE || value == AL_FALSE))
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
slot->AuxSendAuto = value;
+ UpdateEffectSlotProps(slot, AL_FALSE);
break;
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
- UpdateEffectSlotProps(slot);
done:
WriteUnlock(&context->PropLock);
@@ -256,7 +256,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param
default:
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
- UpdateEffectSlotProps(slot);
+ UpdateEffectSlotProps(slot, AL_FALSE);
done:
WriteUnlock(&context->PropLock);
@@ -482,18 +482,24 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e
ALCdevice_Unlock(Device);
RestoreFPUMode(&oldMode);
- EffectSlot->Effect.State = State;
- }
+ if(!effect)
+ {
+ EffectSlot->Effect.Type = AL_EFFECT_NULL;
+ memset(&EffectSlot->Effect.Props, 0, sizeof(EffectSlot->Effect.Props));
+ }
+ else
+ {
+ EffectSlot->Effect.Type = effect->type;
+ memcpy(&EffectSlot->Effect.Props, &effect->Props, sizeof(EffectSlot->Effect.Props));
+ }
- if(!effect)
- {
- EffectSlot->Effect.Type = AL_EFFECT_NULL;
- memset(&EffectSlot->Effect.Props, 0, sizeof(EffectSlot->Effect.Props));
+ EffectSlot->Effect.State = State;
+ UpdateEffectSlotProps(EffectSlot, AL_TRUE);
}
- else
+ else if(effect)
{
- EffectSlot->Effect.Type = effect->type;
memcpy(&EffectSlot->Effect.Props, &effect->Props, sizeof(EffectSlot->Effect.Props));
+ UpdateEffectSlotProps(EffectSlot, AL_FALSE);
}
return AL_NO_ERROR;
@@ -559,7 +565,7 @@ void DeinitEffectSlot(ALeffectslot *slot)
DELETE_OBJ(slot->Params.EffectState);
}
-void UpdateEffectSlotProps(ALeffectslot *slot)
+void UpdateEffectSlotProps(ALeffectslot *slot, ALboolean withstate)
{
struct ALeffectslotProps *props;
ALeffectState *oldstate;
@@ -587,8 +593,10 @@ void UpdateEffectSlotProps(ALeffectslot *slot)
/* Swap out any stale effect state object there may be in the container, to
* delete it.
*/
- oldstate = ATOMIC_EXCHANGE(ALeffectState*, &props->State, slot->Effect.State,
- almemory_order_relaxed);
+ ATOMIC_STORE(&props->UpdateState, withstate, almemory_order_relaxed);
+ oldstate = ATOMIC_EXCHANGE(ALeffectState*, &props->State,
+ withstate ? slot->Effect.State : NULL, almemory_order_relaxed
+ );
/* Set the new container for updating internal parameters. */
props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, props,