aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-04-02 06:35:44 -0700
committerChris Robinson <[email protected]>2017-04-02 06:40:56 -0700
commitb78ddc7ef7bd145a3468e520e9bc4be5c551a952 (patch)
treedcca59c382e95a66807f564a52c0dc3b7cde781b /OpenAL32/alSource.c
parentd52752a3fe4e6c35ceaba4261d2845dca3247c85 (diff)
Make sure the mix is done after setting the looping property
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c9
1 files changed, 9 insertions, 0 deletions
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;