aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-29 00:50:55 -0700
committerChris Robinson <[email protected]>2011-08-29 00:50:55 -0700
commit58078e2c1eb2a3778462c1d0632b0a2c85fe82ec (patch)
tree434158738f276fd2ef6f1c855fa895044a348822 /Alc/ALu.c
parent01503f8a7bd99136445008eba5bed5af483a7aea (diff)
Use atomic exchanges when checking for updates to objects' internal parameters
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index d7eba154..b11a1c3a 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -978,14 +978,11 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
ctx = device->ContextList;
while(ctx)
{
- ALboolean DeferUpdates = ctx->DeferUpdates;
- ALboolean UpdateSources = AL_FALSE;
+ ALenum DeferUpdates = ctx->DeferUpdates;
+ ALenum UpdateSources = AL_FALSE;
if(!DeferUpdates)
- {
- UpdateSources = ctx->UpdateSources;
- ctx->UpdateSources = AL_FALSE;
- }
+ UpdateSources = Exchange_ALenum(&ctx->UpdateSources, AL_FALSE);
src = ctx->ActiveSources;
src_end = src + ctx->ActiveSourceCount;
@@ -998,11 +995,9 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
continue;
}
- if(!DeferUpdates && ((*src)->NeedsUpdate || UpdateSources))
- {
- (*src)->NeedsUpdate = AL_FALSE;
+ if(!DeferUpdates && (Exchange_ALenum(&(*src)->NeedsUpdate, AL_FALSE) ||
+ UpdateSources))
ALsource_Update(*src, ctx);
- }
MixSource(*src, device, SamplesToDo);
src++;
@@ -1024,11 +1019,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
ALEffectSlot->PendingClicks[i] = 0.0f;
}
- if(!DeferUpdates && ALEffectSlot->NeedsUpdate)
- {
- ALEffectSlot->NeedsUpdate = AL_FALSE;
+ if(!DeferUpdates && Exchange_ALenum(&ALEffectSlot->NeedsUpdate, AL_FALSE))
ALEffect_Update(ALEffectSlot->EffectState, ctx, ALEffectSlot);
- }
ALEffect_Process(ALEffectSlot->EffectState, ALEffectSlot,
SamplesToDo, ALEffectSlot->WetBuffer,