//
// FMODAudioEngine::fadeOutMusic from 0x1003e9ef0 to 0x1003e9fc4 (212 bytes)
//
// 4 xrefs:
// > PlayLayer::showCompleteEffect @ 0x1000b45f4
// > LevelAreaInnerLayer::onDoor @ 0x10027ac28
// > GJPathPage::playUnlockAnimation @ 0x100300ed6
// > GauntletSelectLayer::playUnlockAnimation @ 0x100573331
//
// 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::fadeOutMusic(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+8h] [rbp-18h]
float Fade; // [rsp+Ch] [rbp-14h]
v7 = a2;
ActiveMusicChannel = FMODAudioEngine::getActiveMusicChannel(a1, a3);
if ( ActiveMusicChannel )
{
v4 = ActiveMusicChannel;
Fade = FMODAudioEngine::stopAndGetFade(a1, ActiveMusicChannel);
a1->m_lastResult = FMOD::ChannelControl::getDSPClock(v4, nullptr, &v6);
a1->m_lastResult = FMOD::ChannelControl::addFadePoint(v4, v6, Fade);
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),
0.0);
}
}