From b78ddc7ef7bd145a3468e520e9bc4be5c551a952 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 2 Apr 2017 06:35:44 -0700 Subject: Make sure the mix is done after setting the looping property --- OpenAL32/alSource.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index e18a00e2..071ac8d4 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -699,6 +699,15 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p WriteLock(&Source->queue_lock); ATOMIC_STORE_SEQ(&Source->looping, *values); + if(ATOMIC_LOAD(&Source->state, almemory_order_acquire) == AL_PLAYING) + { + /* If the source is playing, wait for the current mix to finish + * to ensure it isn't currently looping back or reaching the + * end. + */ + while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) + althrd_yield(); + } WriteUnlock(&Source->queue_lock); return AL_TRUE; -- cgit v1.2.3