diff options
author | Chris Robinson <[email protected]> | 2016-11-23 01:31:13 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-11-23 01:31:13 -0800 |
commit | 6886f77cbc02b93db3682acb27eb767c6541fba0 (patch) | |
tree | 3c081ac0e3327054214f66706cb8c55739ee3679 | |
parent | fcb669f803d37be80492879801fba9c9011f7edf (diff) |
Only send source updates for sources that have updated
-rw-r--r-- | Alc/ALc.c | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 2 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 11 |
3 files changed, 14 insertions, 2 deletions
@@ -2141,10 +2141,11 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) source->Send[s].LFReference = HIGHPASSFREQREF; s++; } + source->NeedsUpdate = AL_TRUE; } UnlockUIntMapRead(&context->SourceMap); - UpdateAllSourceProps(context); + UpdateListenerProps(context); ReadUnlock(&context->PropLock); context = context->next; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index d5eb3c50..8b793102 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -197,6 +197,8 @@ typedef struct ALsource { ALuint NumChannels; ALuint SampleSize; + ALenum NeedsUpdate; + ATOMIC(struct ALsourceProps*) Update; ATOMIC(struct ALsourceProps*) FreeList; diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index b65c2c18..9ef58115 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -399,6 +399,8 @@ static ALint Int64ValsByProp(ALenum prop) #define DO_UPDATEPROPS() do { \ if(SourceShouldUpdate(Source, Context)) \ UpdateSourceProps(Source, device->NumAuxSends); \ + else \ + Source->NeedsUpdate = AL_TRUE; \ } while(0) static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values) @@ -2772,6 +2774,8 @@ static void InitSourceParams(ALsource *Source) ATOMIC_INIT(&Source->looping, AL_FALSE); + Source->NeedsUpdate = AL_TRUE; + ATOMIC_INIT(&Source->Update, NULL); ATOMIC_INIT(&Source->FreeList, NULL); } @@ -2924,8 +2928,12 @@ void UpdateAllSourceProps(ALCcontext *context) ALvoice *voice = &context->Voices[pos]; ALsource *source = voice->Source; if(source != NULL && (source->state == AL_PLAYING || - source->state == AL_PAUSED)) + source->state == AL_PAUSED) && + source->NeedsUpdate) + { + source->NeedsUpdate = AL_FALSE; UpdateSourceProps(source, num_sends); + } } } @@ -3029,6 +3037,7 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) } } + Source->NeedsUpdate = AL_FALSE; UpdateSourceProps(Source, device->NumAuxSends); } else if(state == AL_PAUSED) |