aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alState.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-08-20 21:35:18 -0700
committerChris Robinson <[email protected]>2014-08-21 00:29:42 -0700
commitb92e643e9742765acd364bcbe30ebaedbe50400f (patch)
treee65318fdffb9105d9b247f425e09b283c855552d /OpenAL32/alState.c
parent3a6baab495d92afd17fccd61b87ae526235fce88 (diff)
Use a NULL source for inactive activesources
Also only access the activesource's source field once per update.
Diffstat (limited to 'OpenAL32/alState.c')
-rw-r--r--OpenAL32/alState.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 4d7b00cf..699bea20 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -732,19 +732,17 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
while(src != src_end)
{
ALsource *source = (*src)->Source;
+ if(!source) goto next;
if(source->state != AL_PLAYING && source->state != AL_PAUSED)
{
- ALactivesource *temp = *(--src_end);
- *src_end = *src;
- *src = temp;
- --(context->ActiveSourceCount);
+ (*src)->Source = NULL;
continue;
}
if(ATOMIC_EXCHANGE(ALenum, &source->NeedsUpdate, AL_FALSE) || UpdateSources)
- (*src)->Update(*src, context);
-
+ (*src)->Update(*src, source, context);
+ next:
src++;
}