//
// PlayLayer::prepareMusic from 0x1000b2db0 to 0x1000b2ea8 (248 bytes)
//
// 2 xrefs:
// > PlayLayer::setupHasCompleted @ 0x1000ae885
// > PlayLayer::startMusic @ 0x1000b3291
//
// 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 PlayLayer::prepareMusic(PlayLayer *a1, bool a2)
{
FMODAudioEngine *v2; // r14
LevelSettingsObject *m_levelSettings; // rax
float v4; // xmm0_4
FMODAudioEngine *v5; // rax
_BYTE v6[16]; // [rsp+0h] [rbp-40h] BYREF
void *__p; // [rsp+10h] [rbp-30h]
float v8; // [rsp+1Ch] [rbp-24h]
if ( (!a1->m_isPracticeMode || a1->m_practiceMusicSync) && !a1->m_playerDied )
{
v2 = FMODAudioEngine::sharedEngine();
GJGameLevel::getAudioFileName(v6, a1->m_level);
FMODAudioEngine::loadMusic(v2, v6, a1->m_isPlatformer, 0, 0, a1->m_levelSettings->m_dontReset, 1.0, 0.0, 1.0);
if ( (v6[0] & 1) != 0 )
operator delete(__p);
m_levelSettings = a1->m_levelSettings;
if ( !m_levelSettings->m_dontReset )
{
v4 = (m_levelSettings->m_songOffset + a1->m_gameState.m_levelTime) * 1000.0;
v8 = v4;
v5 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::setMusicTimeMS(v5, (int)v8, a2, 0);
}
a1->m_musicPrepared = 1;
}
}