mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 00:32:45 +03:00
feat(sound): correct create logic in SESound::GetChannelGroup
This commit is contained in:
parent
7412f9951b
commit
1add43d93c
@ -193,23 +193,6 @@ SEChannelGroup* SESound::GetChannelGroup(const char* name, bool create, bool cre
|
|||||||
|
|
||||||
auto nameHash = SStrHashHT(name);
|
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
|
// Find non-master group matching name hash
|
||||||
|
|
||||||
for (int32_t i = 1; i < SESound::s_ChannelGroups.Count(); i++) {
|
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
|
// 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) {
|
float SESound::GetChannelGroupVolume(const char* name) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user