//
// FMODAudioEngine::stopAllMusic from 0x100138ce4 to 0x100138db4 (208 bytes)
//
// 29 xrefs:
// > LevelInfoLayer::onPlay @ 0x10002668c
// > CreateGuidelinesLayer::onStop @ 0x10007d26c
// > EditLevelLayer::onPlay @ 0x1000ea394
// > OptionsLayer::onMenuMusic @ 0x1000ed428
// > CustomSongWidget::onPlayback @ 0x1000fad2c
// > CustomSongWidget::onPlayback @ 0x1000fad48
// > CustomSongWidget::deleteSong @ 0x1000fce14
// > CustomSongCell::onDelete @ 0x100110308
// > PlayLayer::togglePracticeMode @ 0x100121a54
// > PlayLayer::resetLevelFromStart @ 0x100121b40
// > PlayLayer::resumeAndRestart @ 0x100122978
// > FMODAudioEngine::clearAllAudio @ 0x100138bd4
// > CustomSongLayer::onClose @ 0x1001445e0
// > CustomSongLayer::onCreateLines @ 0x100144710
// > CustomSongLayer::onSearch @ 0x100144784
// > SongOptionsLayer::onPlayback @ 0x1001459e0
// > GJShopLayer::dialogClosed @ 0x10014d664
// > SetupSongTriggerPopup::onPlayback @ 0x1001c34bc
// > SetupSongTriggerPopup::valueDidChange @ 0x1001c36b4
// > SetupSongTriggerPopup::onClose @ 0x1001c37d0
// > GJSongBrowser::exitLayer @ 0x100265b3c
// > EndLevelLayer::onEdit @ 0x1002f7450
// > GameManager::playMenuMusic @ 0x1003120d0
// > GameManager::fadeInMenuMusic @ 0x100312318
// > LevelEditorLayer::init @ 0x100356ca0
// > LevelEditorLayer::stopPlayback @ 0x100362734
// > LevelEditorLayer::onStopPlaytest @ 0x100363538
// > SongInfoLayer::onBPM @ 0x1003a8878
// > LevelPage::onPlay @ 0x100403a5c
//
// 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 __fastcall FMODAudioEngine::stopAllMusic(FMODAudioEngine *a1, bool a2)
{
FMOD::ChannelGroup *m_backgroundMusicChannel; // x0
std::__hash_node_base, void *> *>::__next_pointer next; // x20
int *v5; // x20
int *v6; // x21
FMOD::Channel *v7; // x0
int *v8; // [xsp+8h] [xbp-38h] BYREF
int *v9; // [xsp+10h] [xbp-30h]
__int64 v10; // [xsp+18h] [xbp-28h]
if ( a2 )
{
m_backgroundMusicChannel = a1->m_backgroundMusicChannel;
if ( m_backgroundMusicChannel )
FMOD::ChannelControl::stop(m_backgroundMusicChannel);
sub_100018054(&a1->m_audioState.m_volumeForMusicChannels.__table_.__bucket_list_.__ptr_.__value_);
sub_100018054(&a1->m_audioState.m_volumeModForMusicChannels.__table_.__bucket_list_.__ptr_.__value_);
sub_100018054(&a1->m_audioState.m_pitchForMusicChannels.__table_.__bucket_list_.__ptr_.__value_);
}
else
{
v8 = nullptr;
v9 = nullptr;
v10 = 0;
next = a1->m_fmodMusic.__table_.__p1_.__value_.__next_;
if ( next )
{
do
{
if ( (BYTE1(next[8].__next_) & 1) == 0 )
sub_10000CBA8((__int64)&v8, (int *)&next[3]);
next = next->__next_;
}
while ( next );
v5 = v8;
v6 = v9;
if ( v8 != v9 )
{
do
{
v7 = FMODAudioEngine::channelForChannelID(a1, *v5);
if ( v7 )
FMOD::ChannelControl::stop(v7);
++v5;
}
while ( v5 != v6 );
v5 = v8;
}
if ( v5 )
{
v9 = v5;
operator delete(v5);
}
}
}
}