From 7bf64eaee0788b7eb64c7410384a9ee66f75c4ce Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 19 May 2016 20:50:55 -0700 Subject: Make the source position calues atomic --- Alc/ALu.c | 4 ++-- Alc/mixer.c | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Alc') diff --git a/Alc/ALu.c b/Alc/ALu.c index 44361979..ec0dd011 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -1619,8 +1619,8 @@ ALvoid aluHandleDisconnect(ALCdevice *device) { source->state = AL_STOPPED; ATOMIC_STORE(&source->current_buffer, NULL); - source->position = 0; - source->position_fraction = 0; + ATOMIC_STORE(&source->position, 0); + ATOMIC_STORE(&source->position_fraction, 0); } voice++; diff --git a/Alc/mixer.c b/Alc/mixer.c index 38ec295c..1ee422be 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -384,10 +384,10 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam ALuint chan, j; /* Get source info */ - State = Source->state; + State = AL_PLAYING; /* Only called while playing. */ BufferListItem = ATOMIC_LOAD(&Source->current_buffer); - DataPosInt = Source->position; - DataPosFrac = Source->position_fraction; + DataPosInt = ATOMIC_LOAD(&Source->position, almemory_order_relaxed); + DataPosFrac = ATOMIC_LOAD(&Source->position_fraction, almemory_order_relaxed); NumChannels = Source->NumChannels; SampleSize = Source->SampleSize; Looping = voice->Looping; @@ -752,8 +752,8 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam voice->Moving = AL_TRUE; /* Update source info */ - Source->state = State; - ATOMIC_STORE(&Source->current_buffer, BufferListItem); - Source->position = DataPosInt; - Source->position_fraction = DataPosFrac; + Source->state = State; + ATOMIC_STORE(&Source->current_buffer, BufferListItem, almemory_order_relaxed); + ATOMIC_STORE(&Source->position, DataPosInt, almemory_order_relaxed); + ATOMIC_STORE(&Source->position_fraction, DataPosFrac); } -- cgit v1.2.3