feat(sound): correct create logic in SESound::GetChannelGroup

This commit is contained in:
fallenoak committed 2025-11-29 15:05:05 -06:00
1 parent 7412f9951b
commit 1add43d93c
1 file changed
+12 -18
+12 -18
View File
@@ -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) {