diff options
author | Chris Robinson <[email protected]> | 2016-08-08 22:31:08 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-08-08 22:31:08 -0700 |
commit | 56d3598020f553681ec88b830c21218556a80a84 (patch) | |
tree | 9c734592ad323d778e687c39291195cf32baa0a9 /OpenAL32 | |
parent | 6117cb2377b95e5800b6ff4febe77cf029d58e64 (diff) |
Avoid checking DeferUpdates for each source state change
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/alSource.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 0e98f2f5..fb2ada10 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -2316,13 +2316,21 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) context->MaxVoices = newcount; } - for(i = 0;i < n;i++) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) { - source = LookupSource(context, sources[i]); - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) + for(i = 0;i < n;i++) + { + source = LookupSource(context, sources[i]); source->new_state = AL_PLAYING; - else + } + } + else + { + for(i = 0;i < n;i++) + { + source = LookupSource(context, sources[i]); SetSourceState(source, context, AL_PLAYING); + } } UnlockContext(context); @@ -2354,13 +2362,21 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) } LockContext(context); - for(i = 0;i < n;i++) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) { - source = LookupSource(context, sources[i]); - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) + for(i = 0;i < n;i++) + { + source = LookupSource(context, sources[i]); source->new_state = AL_PAUSED; - else + } + } + else + { + for(i = 0;i < n;i++) + { + source = LookupSource(context, sources[i]); SetSourceState(source, context, AL_PAUSED); + } } UnlockContext(context); |