//
// FMODAudioEngine::fadeInMusic from 0x1003e70c0 to 0x1003e7192 (210 bytes)
//
// 3 xrefs:
// > PlayLayer::startMusic @ 0x1000b32d9
// > GJPathPage::unlockAnimationStep3 @ 0x1003027e1
// > GauntletSelectLayer::unlockAnimationStep3 @ 0x100573f97
//
// 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::fadeInMusic(FMODAudioEngine *a1, float a2, int a3)
{
FMOD::Channel *ActiveMusicChannel; // rax
FMOD::ChannelControl *v4; // r14
float v5; // xmm0_4
unsigned __int64 v6; // [rsp+0h] [rbp-20h] BYREF
float v7; // [rsp+Ch] [rbp-14h]
v7 = a2;
ActiveMusicChannel = FMODAudioEngine::getActiveMusicChannel(a1, a3);
if ( ActiveMusicChannel )
{
v4 = ActiveMusicChannel;
FMODAudioEngine::stopAndGetFade(a1, ActiveMusicChannel);
a1->m_lastResult = FMOD::ChannelControl::getDSPClock(v4, nullptr, &v6);
a1->m_lastResult = FMOD::ChannelControl::addFadePoint(v4, v6, 0.0);
if ( (v6 & 0x8000000000000000LL) != 0LL )
v5 = (float)(int)((v6 >> 1) | v6 & 1) + (float)(int)((v6 >> 1) | v6 & 1);
else
v5 = (float)(int)v6;
a1->m_lastResult = FMOD::ChannelControl::addFadePoint(
v4,
(unsigned int)(int)(float)((float)((float)a1->m_sampleRate * v7) + v5),
1.0);
}
}