//
// FMODAudioEngine::stopAllMusic from 0x140059da0 to 0x140059eab (267 bytes)
//
// 2 xrefs:
// > PlayLayer::resumeAndRestart @ 0x1403ba479
// > ??> @ 0x1406c528c
//
// 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
//
// Hidden C++ exception states: #wind=1
void FMODAudioEngine::stopAllMusic(FMODAudioEngine *a1, bool a2)
{
FMOD::ChannelGroup *m_backgroundMusicChannel; // rcx
int *v4; // rcx
std::_List_val>>::_Nodeptr Myhead; // rax
__int64 *v6; // rbx
int *v7; // rdi
int *v8; // r8
int *i; // rbx
FMOD::Channel *v10; // rax
__int128 v11; // [rsp+20h] [rbp-28h] BYREF
int *v12; // [rsp+30h] [rbp-18h]
if ( a2 )
{
m_backgroundMusicChannel = a1->m_backgroundMusicChannel;
if ( m_backgroundMusicChannel )
FMOD::ChannelControl::stop(m_backgroundMusicChannel);
sub_14005E0D0(&a1->m_audioState.m_volumeForMusicChannels);
sub_14005E0D0(&a1->m_audioState.m_volumeModForMusicChannels);
sub_14005E0D0(&a1->m_audioState.m_pitchForMusicChannels);
}
else
{
v11 = 0;
v4 = nullptr;
v12 = nullptr;
Myhead = a1->m_fmodMusic._List._Mypair._Myval2._Myhead;
v6 = *(__int64 **)Myhead;
v7 = nullptr;
if ( *(std::_List_val>>::_Nodeptr *)Myhead != Myhead )
{
do
{
if ( !*((_BYTE *)v6 + 73) )
{
v8 = (int *)(v6 + 3);
if ( v7 == v4 )
{
sub_140063270(&v11, v7, v8);
v4 = v12;
v7 = *((int **)&v11 + 1);
}
else
{
*v7++ = *v8;
*((_QWORD *)&v11 + 1) = v7;
}
}
v6 = (__int64 *)*v6;
}
while ( v6 != (__int64 *)a1->m_fmodMusic._List._Mypair._Myval2._Myhead );
}
for ( i = (int *)v11; i != v7; ++i )
{
v10 = FMODAudioEngine::channelForChannelID(a1, *i);
if ( v10 )
FMOD::ChannelControl::stop(v10);
}
sub_14005E430(&v11);
}
}