//
// FMODAudioEngine::fadeOutMusic from 0x302998 to 0x302a52 (186 bytes)
//
// 4 xrefs:
// > PlayLayer::showCompleteEffect @ 0x30fc4a
// > GauntletSelectLayer::playUnlockAnimation @ 0x4d759c
// > LevelAreaInnerLayer::onDoor @ 0x56bd44
// > GJPathPage::playUnlockAnimation @ 0x58c4d0
//
// 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 FMODAudioEngine::fadeOutMusic(FMODAudioEngine *a1, float a2, int a3)
{
FMOD::Channel *ActiveMusicChannel; // r0
FMOD::ChannelControl *v6; // r6
float Fade; // r8
unsigned __int64 v8; // [sp+8h] [bp-10h] BYREF
ActiveMusicChannel = FMODAudioEngine::getActiveMusicChannel(a1, a3);
v6 = ActiveMusicChannel;
if ( ActiveMusicChannel )
{
Fade = FMODAudioEngine::stopAndGetFade(a1, ActiveMusicChannel);
a1->m_lastResult = FMOD::ChannelControl::getDSPClock(v6, nullptr, &v8);
ERRCHECK_fn();
a1->m_lastResult = FMOD::ChannelControl::addFadePoint(v6, v8, Fade);
ERRCHECK_fn();
a1->m_lastResult = FMOD::ChannelControl::addFadePoint(
v6,
(unsigned __int64)(float)((float)v8 + (float)((float)a1->m_sampleRate * a2)),
0.0);
ERRCHECK_fn();
}
}