From 1add43d93c5984571858d47ecaacbb9a7a50706a Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sat, 29 Nov 2025 15:05:05 -0600 Subject: [PATCH] feat(sound): correct create logic in SESound::GetChannelGroup --- src/sound/SESound.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/sound/SESound.cpp b/src/sound/SESound.cpp index cac2ef9..6996486 100644 --- a/src/sound/SESound.cpp +++ b/src/sound/SESound.cpp @@ -193,23 +193,6 @@ SEChannelGroup* SESound::GetChannelGroup(const char* name, bool create, bool cre auto nameHash = SStrHashHT(name); - // No groups or only master group exist - - if (SESound::s_ChannelGroups.Count() <= 1) { - if (!create) { - return nullptr; - } - - auto newChannelGroup = SESound::s_ChannelGroups.New(); - newChannelGroup->m_nameHash = nameHash; - newChannelGroup->m_parentChannelGroup = createInMaster ? 0 : -1; - newChannelGroup->m_volume = 1.0f; - newChannelGroup->m_muteVolume = 1.0f; - newChannelGroup->m_dirty = true; - - return newChannelGroup; - } - // Find non-master group matching name hash for (int32_t i = 1; i < SESound::s_ChannelGroups.Count(); i++) { @@ -222,7 +205,18 @@ SEChannelGroup* SESound::GetChannelGroup(const char* name, bool create, bool cre // No matches - return nullptr; + if (!create) { + return nullptr; + } + + auto newChannelGroup = SESound::s_ChannelGroups.New(); + newChannelGroup->m_nameHash = nameHash; + newChannelGroup->m_parentChannelGroup = createInMaster ? 0 : -1; + newChannelGroup->m_volume = 1.0f; + newChannelGroup->m_muteVolume = 1.0f; + newChannelGroup->m_dirty = true; + + return newChannelGroup; } float SESound::GetChannelGroupVolume(const char* name) {