//
// FMODAudioEngine::updateChannel from 0x303080 to 0x30320c (396 bytes)
//
// 10 xrefs:
// > GJBaseGameLayer::applySFXEditTrigger @ 0x478152
// > GJBaseGameLayer::applySFXEditTrigger @ 0x478176
// > GJBaseGameLayer::processSongState @ 0x478e42
// > GJBaseGameLayer::processSongState @ 0x478e64
// > GJBaseGameLayer::processSongState @ 0x478ec4
// > GJBaseGameLayer::processSongState @ 0x478ee4
// > GJBaseGameLayer::processSongState @ 0x478f9c
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x48b76a
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x48b87e
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x48b896
//
// 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
//
void FMODAudioEngine::updateChannel(
FMODAudioEngine *a1,
int a2,
AudioTargetType a3,
AudioModType a4,
float a5,
float a6)
{
std::map,FMODSoundTween> *TweenContainer; // r7
std::unordered_map *p_m_volumeForEffectGroups; // r4
std::unordered_map *p_m_pitchForEffectGroups; // r0
int v12; // r5
int v13; // r4
_DWORD *v14; // r10
AudioModType v15; // r1
_BOOL4 v16; // r0
std::_rb_tree_base *m_parent; // r8
std::_rb_tree_base *p_m_header; // r5
std::_rb_tree_base *m_left; // r3
int v20; // r0
_BOOL4 v21; // r0
int v22; // [sp+4h] [bp-28h] BYREF
double v23; // [sp+8h] [bp-24h] BYREF
int v24; // [sp+14h] [bp-18h] BYREF
AudioModType v25; // [sp+18h] [bp-14h]
char v26[8]; // [sp+1Ch] [bp-10h] BYREF
v22 = a2;
v25 = a4;
v24 = a2;
TweenContainer = FMODAudioEngine::getTweenContainer(a1, a3);
std::_Rb_tree,std::pair const,FMODSoundTween>,std::_Select1st const,FMODSoundTween>>,std::less>,std::allocator const,FMODSoundTween>>>::erase(
TweenContainer,
&v24);
if ( a5 <= 0.0 )
{
if ( a4 )
{
if ( a4 == Pitch )
FMODAudioEngine::setChannelPitch(a1, v22, a3, a6);
}
else
{
FMODAudioEngine::setChannelVolume(a1, v22, a3, a6);
}
return;
}
if ( a4 )
{
if ( a4 != Pitch )
{
v12 = 0;
goto LABEL_20;
}
if ( a3 == SFXGroup )
{
p_m_pitchForEffectGroups = &a1->m_audioState.m_pitchForEffectGroups;
}
else if ( a3 == MusicChannel )
{
p_m_pitchForEffectGroups = &a1->m_audioState.m_pitchForMusicChannels;
}
else
{
p_m_pitchForEffectGroups = &a1->m_audioState.m_pitchForEffectChannels;
}
}
else if ( a3 == SFXGroup )
{
p_m_volumeForEffectGroups = &a1->m_audioState.m_volumeForEffectGroups;
v23 = 1.0;
sub_30113C((int)v26, p_m_volumeForEffectGroups, (unsigned int *)&v22, &v23);
p_m_pitchForEffectGroups = p_m_volumeForEffectGroups;
}
else if ( a3 == MusicChannel )
{
p_m_pitchForEffectGroups = &a1->m_audioState.m_volumeForMusicChannels;
}
else
{
p_m_pitchForEffectGroups = &a1->m_audioState.m_volumeForEffectChannels;
}
v12 = *std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
p_m_pitchForEffectGroups,
(unsigned int *)&v22);
LABEL_20:
v13 = operator new(0x30u);
v14 = (_DWORD *)(v13 + 16);
v15 = v25;
*(_DWORD *)(v13 + 16) = v24;
*(_DWORD *)(v13 + 20) = v15;
v16 = 1;
*(float *)(v13 + 28) = a5;
*(float *)(v13 + 36) = a6;
m_parent = TweenContainer->m_header.m_parent;
*(_DWORD *)(v13 + 32) = v12;
*(_DWORD *)(v13 + 40) = v12;
p_m_header = &TweenContainer->m_header;
*(_DWORD *)(v13 + 24) = 0;
*(_BYTE *)(v13 + 44) = 0;
while ( m_parent )
{
v16 = std::operator<(v14, &m_parent[1].m_isblack);
if ( v16 )
m_left = m_parent->m_left;
else
m_left = m_parent->m_right;
p_m_header = m_parent;
m_parent = m_left;
}
if ( !v16 )
{
v20 = (int)p_m_header;
LABEL_30:
if ( !std::operator<((_DWORD *)(v20 + 16), v14) )
{
operator delete((void *)v13);
return;
}
goto LABEL_32;
}
if ( p_m_header != TweenContainer->m_header.m_left )
{
v20 = sub_762018(p_m_header);
goto LABEL_30;
}
LABEL_32:
v21 = p_m_header == &TweenContainer->m_header || std::operator<(v14, &p_m_header[1].m_isblack);
sub_7620E8(v21, v13, p_m_header, &TweenContainer->m_header);
++TweenContainer->m_nodecount;
}