//
// FMODAudioEngine::getChannelGroup from 0x10013b560 to 0x10013b750 (496 bytes)
//
// 7 xrefs:
// > FMODAudioEngine::playEffectAdvanced @ 0x10013a990
// > FMODAudioEngine::setChannelVolume @ 0x10013b188
// > FMODAudioEngine::setChannelVolume @ 0x10013b1c8
// > FMODAudioEngine::setChannelPitch @ 0x10013b340
// > FMODAudioEngine::setChannelPitch @ 0x10013b358
// > FMODAudioEngine::setChannelVolumeMod @ 0x10013c9b0
// > FMODAudioEngine::setChannelVolumeMod @ 0x10013c9f0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
FMOD::ChannelGroup *__fastcall FMODAudioEngine::getChannelGroup(FMODAudioEngine *a1, int a2, bool a3)
{
_BOOL4 v3; // w20
std::unordered_map *p_m_reverbChannelGroups; // x0
FMOD::ChannelGroup *v7; // x20
std::unordered_map *p_m_globalChannelGroups; // x0
FMOD::ChannelGroup *v9; // [xsp+8h] [xbp-38h] BYREF
int v10; // [xsp+10h] [xbp-30h] BYREF
int *v11; // [xsp+18h] [xbp-28h] BYREF
v3 = a3;
v10 = a2;
if ( a2 )
{
v9 = nullptr;
if ( a3 )
{
if ( !sub_100018814(&a1->m_reverbChannelGroups.__table_.__bucket_list_.__ptr_.__value_, &v10) )
goto LABEL_10;
v11 = &v10;
p_m_reverbChannelGroups = &a1->m_reverbChannelGroups;
}
else
{
if ( !sub_100018814(&a1->m_globalChannelGroups.__table_.__bucket_list_.__ptr_.__value_, &v10) )
goto LABEL_10;
v11 = &v10;
p_m_reverbChannelGroups = &a1->m_globalChannelGroups;
}
v9 = (FMOD::ChannelGroup *)sub_100019F24(
(unsigned __int64)p_m_reverbChannelGroups,
&v10,
(__int64)&unk_100637FD3,
&v11)[3];
if ( v9 )
return v9;
LABEL_10:
FMOD::System::createChannelGroup(a1->m_system, nullptr, &v9);
if ( !sub_100018814(&a1->m_audioState.m_volumeForEffectGroups.__table_.__bucket_list_.__ptr_.__value_, &v10) )
{
v11 = &v10;
*((_DWORD *)sub_10001D150(
(unsigned __int64)&a1->m_audioState.m_volumeForEffectGroups,
&v10,
(__int64)&unk_100637FD3,
&v11)
+ 5) = 1065353216;
}
if ( !sub_100018814(&a1->m_audioState.m_volumeModForEffectGroups.__table_.__bucket_list_.__ptr_.__value_, &v10) )
{
v11 = &v10;
*((_DWORD *)sub_10001D150(
(unsigned __int64)&a1->m_audioState.m_volumeModForEffectGroups,
&v10,
(__int64)&unk_100637FD3,
&v11)
+ 5) = 1065353216;
}
if ( !sub_100018814(&a1->m_audioState.m_pitchForEffectGroups.__table_.__bucket_list_.__ptr_.__value_, &v10) )
{
v11 = &v10;
*((_DWORD *)sub_10001D150(
(unsigned __int64)&a1->m_audioState.m_pitchForEffectGroups,
&v10,
(__int64)&unk_100637FD3,
&v11)
+ 5) = 1065353216;
}
if ( v3 )
{
FMOD::ChannelGroup::addGroup(a1->m_reverbChannel, (bool)v9, (FMOD::DSPConnection **)1);
v7 = v9;
v11 = &v10;
p_m_globalChannelGroups = &a1->m_reverbChannelGroups;
}
else
{
FMOD::ChannelGroup::addGroup(a1->m_globalChannel, (bool)v9, (FMOD::DSPConnection **)1);
v7 = v9;
v11 = &v10;
p_m_globalChannelGroups = &a1->m_globalChannelGroups;
}
sub_100019F24((unsigned __int64)p_m_globalChannelGroups, &v10, (__int64)&unk_100637FD3, &v11)[3] = v7;
return v9;
}
if ( a3 )
return a1->m_reverbChannel;
else
return a1->m_globalChannel;
}