From d3980bdebc379c104c406223e0d83e78b16bd791 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 26 Jul 2014 16:41:39 -0700 Subject: Always set the active source's update method If the source is stopped, changes its buffer, then played again quickly, the source will never be removed from the active source list causing the update method to remain as it was. If the buffer was changed between mono and multi- channel, this causes it to use the wrong method. --- OpenAL32/alSource.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index d7859eff..9a4088a2 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -2500,13 +2500,9 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) Context->ActiveSources[Context->ActiveSourceCount] = src; } memset(src, 0, sizeof(*src)); + Context->ActiveSourceCount++; src->Source = Source; - if(BufferList->buffer->FmtChannels == FmtMono) - src->Update = CalcSourceParams; - else - src->Update = CalcNonAttnSourceParams; - Context->ActiveSourceCount++; } else { @@ -2530,6 +2526,12 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) src->Send[i].Moving = AL_FALSE; } } + + if(BufferList->buffer->FmtChannels == FmtMono) + src->Update = CalcSourceParams; + else + src->Update = CalcNonAttnSourceParams; + ATOMIC_STORE(&Source->NeedsUpdate, AL_TRUE); } else if(state == AL_PAUSED) -- cgit v1.2.3