From c18bf15a37b01525f87d976e98ad4f62d6d288a6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 20 Jan 2023 12:52:54 -0800 Subject: Don't force an update if there is no aux slot being replaced A null effect slot can't be deleted, so we don't need to make sure it's set to change before returning. --- al/source.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'al/source.cpp') diff --git a/al/source.cpp b/al/source.cpp index 1e4a5a50..8e67ac64 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -1717,7 +1717,13 @@ try { send.LFReference = HIGHPASSFREQREF; } - if(slot != Source->Send[static_cast(values[1])].Slot && IsPlayingOrPaused(Source)) + /* We must force an update if the current auxiliary slot is valid and + * about to be changed on an active source, in case the old slot is + * about to be deleted. + */ + if(Source->Send[static_cast(values[1])].Slot + && slot != Source->Send[static_cast(values[1])].Slot + && IsPlayingOrPaused(Source)) { /* Add refcount on the new slot, and release the previous slot */ if(slot) IncrementRef(slot->ref); @@ -1725,9 +1731,6 @@ try { DecrementRef(oldslot->ref); Source->Send[static_cast(values[1])].Slot = slot; - /* We must force an update if the auxiliary slot changed on an - * active source, in case the slot is about to be deleted. - */ Voice *voice{GetSourceVoice(Source, Context)}; if(voice) UpdateSourceProps(Source, voice, Context); else Source->mPropsDirty = true; -- cgit v1.2.3