//
// FMODAudioEngine::fadeInMusic from 0x1003d4620 to 0x1003d46f2 (210 bytes)
//
// 2 xrefs:
// > PlayLayer::startMusic @ 0x1000809fc
// > GJPathPage::unlockAnimationStep3 @ 0x1002ed4c1
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:29:40 +0000
//
FMOD::ChannelControl *__fastcall FMODAudioEngine::fadeInMusic(__int64 a1, int a2, float a3)
{
FMOD::ChannelControl *result; // rax
FMOD::ChannelControl *v4; // r14
float v5; // xmm0_4
unsigned __int64 v6; // [rsp+0h] [rbp-20h] BYREF
float v7; // [rsp+Ch] [rbp-14h]
v7 = a3;
result = (FMOD::ChannelControl *)FMODAudioEngine::getActiveMusicChannel(a1, a2);
if ( result )
{
v4 = result;
FMODAudioEngine::stopAndGetFade(a1, result);
*(_DWORD *)(a1 + 536) = FMOD::ChannelControl::getDSPClock(v4, nullptr, &v6);
*(_DWORD *)(a1 + 536) = 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;
result = (FMOD::ChannelControl *)FMOD::ChannelControl::addFadePoint(
v4,
(unsigned int)(int)(float)((float)((float)*(int *)(a1 + 540) * v7) + v5),
1.0);
*(_DWORD *)(a1 + 536) = (_DWORD)result;
}
return result;
}