Only send source updates for sources that have updated

This commit is contained in:
Chris Robinson
2016-11-23 01:31:13 -08:00
parent fcb669f803
commit 6886f77cbc
3 changed files with 14 additions and 2 deletions
+2 -1
View File
@@ -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;
+2
View File
@@ -197,6 +197,8 @@ typedef struct ALsource {
ALuint NumChannels;
ALuint SampleSize;
ALenum NeedsUpdate;
ATOMIC(struct ALsourceProps*) Update;
ATOMIC(struct ALsourceProps*) FreeList;
+10 -1
View File
@@ -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)