//
// FMODAudioEngine::playMusic from 0x5b6da8 to 0x5b6f14 (364 bytes)
//
// 7 xrefs:
// > PlayLayer::togglePracticeMode @ 0x5d2498
// > GameManager::fadeInMusic @ 0x5e8d20
// > GameManager::playMenuMusic @ 0x5efe94
// > CustomSongWidget::onPlayback @ 0x74277c
// > GJShopLayer::showReactMessage @ 0x92cbd4
// > GJShopLayer::init @ 0x92e384
// > ??> @ 0x3f660
//
// 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
//
__int64 __fastcall FMODAudioEngine::playMusic(FMODAudioEngine *a1, __int64 a2, unsigned __int8 a3, int a4, float a5)
{
void *v9; // x0
unsigned int *v11; // x2
int v12; // w1
__int64 v13; // [xsp+50h] [xbp+50h] BYREF
if ( a1->m_backgroundMusicChannel )
{
sub_D18D28(&v13, a2);
FMODAudioEngine::loadMusic((__int64)a1, &v13, a3, a4, 0, 0, 1.0, 0.0, 1.0);
v9 = (void *)(v13 - 24);
if ( (__int64 *)(v13 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v13 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(v13 - 8);
*(_DWORD *)(v13 - 8) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v9);
}
if ( a5 > 0.0 )
FMODAudioEngine::fadeInMusic(a1, a5, a4);
FMODAudioEngine::resumeMusic(a1, a4);
LOBYTE(v13) = 0;
FMOD::ChannelControl::getPaused(a1->m_backgroundMusicChannel, (bool *)&v13);
FMODAudioEngine::getActiveMusicChannel(a1, a4);
}
return _stack_chk_guard;
}