diff options
author | Chris Robinson <[email protected]> | 2016-08-23 19:37:26 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-08-23 19:37:26 -0700 |
commit | ea2fb38627a0549c17f2a875dd9a2481712efbe3 (patch) | |
tree | 3b5904a5cb13ebdcf2c22099a7eba70e8baaf4bd | |
parent | c7eb0b7393231a137c31f75e0654214a08bc51a9 (diff) |
Hold updates for both listener and source updates
-rw-r--r-- | Alc/ALc.c | 16 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 11 |
2 files changed, 15 insertions, 12 deletions
@@ -1601,6 +1601,16 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) if(ATOMIC_EXCHANGE(ALenum, &context->DeferUpdates, AL_FALSE)) { ALsizei pos; + uint updates; + + /* Tell the mixer to stop applying updates, then wait for any active + * updating to finish, before providing updates. + */ + ATOMIC_STORE(&context->HoldUpdates, AL_TRUE); + while(((updates=ReadRef(&context->UpdateCount))&1) != 0) + althrd_yield(); + + UpdateListenerProps(context); LockUIntMapRead(&context->SourceMap); V0(device->Backend,lock)(); @@ -1625,8 +1635,12 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) V0(device->Backend,unlock)(); UnlockUIntMapRead(&context->SourceMap); - UpdateListenerProps(context); UpdateAllSourceProps(context); + + /* Now with all updates declared, let the mixer continue applying them + * so they all happen at once. + */ + ATOMIC_STORE(&context->HoldUpdates, AL_FALSE); } ReadUnlock(&context->PropLock); } diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 891286a2..678654df 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -2910,15 +2910,8 @@ static void UpdateSourceProps(ALsource *source, ALuint num_sends) void UpdateAllSourceProps(ALCcontext *context) { ALuint num_sends = context->Device->NumAuxSends; - uint updates; ALsizei pos; - /* Tell the mixer to stop applying updates, then wait for any active - * updating to finish, before providing source updates. - */ - ATOMIC_STORE(&context->HoldUpdates, AL_TRUE); - while(((updates=ReadRef(&context->UpdateCount))&1) != 0) - althrd_yield(); for(pos = 0;pos < context->VoiceCount;pos++) { ALvoice *voice = &context->Voices[pos]; @@ -2927,10 +2920,6 @@ void UpdateAllSourceProps(ALCcontext *context) source->state == AL_PAUSED)) UpdateSourceProps(source, num_sends); } - /* Now with all updates declared, let the mixer continue applying them so - * they all happen at once. - */ - ATOMIC_STORE(&context->HoldUpdates, AL_FALSE); } |