aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c4
-rw-r--r--Alc/ALu.c12
2 files changed, 10 insertions, 6 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index e5c18d8c..dfbb6c63 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2052,7 +2052,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
RestoreFPUMode(&oldMode);
return ALC_INVALID_DEVICE;
}
- UpdateEffectSlotProps(slot, AL_FALSE);
+ UpdateEffectSlotProps(slot);
}
context = ATOMIC_LOAD(&device->ContextList);
@@ -2077,7 +2077,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
return ALC_INVALID_DEVICE;
}
- UpdateEffectSlotProps(slot, AL_FALSE);
+ UpdateEffectSlotProps(slot);
}
UnlockUIntMapRead(&context->EffectSlotMap);
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 2fffdcd9..329d01eb 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -336,6 +336,7 @@ static void CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device)
{
struct ALeffectslotProps *first;
struct ALeffectslotProps *props;
+ ALeffectState *state;
props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, NULL, almemory_order_acq_rel);
if(!props) return;
@@ -355,13 +356,16 @@ static void CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device)
slot->Params.DecayTime = 0.0f;
slot->Params.AirAbsorptionGainHF = 1.0f;
}
+ state = ATOMIC_EXCHANGE(ALeffectState*, &props->State, NULL, almemory_order_relaxed);
+
/* If the state object is changed, exchange it with the current one so it
* remains in the freelist and isn't leaked.
*/
- if(ATOMIC_LOAD(&props->UpdateState, almemory_order_relaxed))
- slot->Params.EffectState = ATOMIC_EXCHANGE(ALeffectState*,
- &props->State, slot->Params.EffectState, almemory_order_relaxed
- );
+ if(state != slot->Params.EffectState)
+ {
+ ATOMIC_STORE(&props->State, slot->Params.EffectState, almemory_order_relaxed);
+ slot->Params.EffectState = state;
+ }
V(slot->Params.EffectState,update)(device, slot, &props->Props);