//
// FMODAudioEngine::startMusic from 0x6d60c4 to 0x6d6480 (956 bytes)
//
// 4 xrefs:
// > FMODAudioEngine::triggerQueuedMusic @ 0x6d9110
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x9e1df8
// > SetupSongTriggerPopup::onPlayback @ 0xaea1c8
// > ??> @ 0xea778
//
// This function is hookable on this platform (idp: arm, 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:51:30 +0000
//
__int64 __fastcall FMODAudioEngine::startMusic(
FMODAudioEngine *this,
signed int a2,
signed int a3,
int a4,
int a5,
unsigned __int8 a6,
int a7,
unsigned __int8 a8,
bool a9)
{
int v14; // w27
int *v15; // x0
FMOD::Channel *v16; // x0
FMOD::Channel *v17; // x20
_BOOL4 v19; // w23
float v20; // s8
int v21; // w22
int v22; // [xsp+88h] [xbp+88h]
int v23[4]; // [xsp+8Ch] [xbp+8Ch] BYREF
unsigned int v24; // [xsp+9Ch] [xbp+9Ch] BYREF
float v25; // [xsp+A0h] [xbp+A0h] BYREF
unsigned int v26; // [xsp+A4h] [xbp+A4h] BYREF
FMOD::Sound *v27; // [xsp+A8h] [xbp+A8h] BYREF
unsigned int v28[2]; // [xsp+B0h] [xbp+B0h] BYREF
v22 = a8;
v14 = a6;
v23[0] = a7;
FMODAudioEngine::stopChannelTweens((__int64)this, a7, 2);
v15 = (int *)std::unordered_map::operator[]((__int64)this + 320, v23);
v16 = (FMOD::Channel *)FMODAudioEngine::channelForChannelID(this, *v15);
v17 = v16;
if ( !v16 )
return _stack_chk_guard;
if ( a2 > 0 || a3 > 0 || a4 > 0 || a5 > 0 )
{
v27 = nullptr;
FMOD::Channel::getCurrentSound(v16, &v27);
if ( v27 )
{
v24 = 0;
FMOD::Sound::getLength(v27, &v24, 1u);
if ( v14 )
FMOD::Channel::setLoopCount(v17, -1);
else
FMOD::Channel::setLoopCount(v17, 0);
v25 = 1.0;
FMOD::ChannelControl::getPitch(v17, &v25);
if ( a3 > 0 || a4 > 0 )
{
*((_DWORD *)this + 134) = FMOD::ChannelControl::getDSPClock(v17, nullptr, (unsigned __int64 *)v28);
ERRCHECK_fn();
if ( a4 > 0 )
{
*((_DWORD *)this + 134) = FMOD::ChannelControl::addFadePoint(v17, *(unsigned __int64 *)v28, 0.0);
ERRCHECK_fn();
*((_DWORD *)this + 134) = FMOD::ChannelControl::addFadePoint(
v17,
(unsigned __int64)(float)((float)*(unsigned __int64 *)v28
+ (float)((float)*((int *)this + 135)
* (float)((float)a4 / 1000.0))),
1.0);
ERRCHECK_fn();
}
if ( v14 )
goto LABEL_21;
v19 = a5 > 0;
if ( a3 > 0 )
{
v21 = a3 - a2;
if ( v21 < 0 )
v21 = 0;
if ( v21 )
{
v20 = (float)((float)v21 / v25) / 1000.0;
*((_DWORD *)this + 134) = FMOD::ChannelControl::setDelay(
v17,
0,
(unsigned __int64)(float)((float)*(unsigned __int64 *)v28
+ (float)((float)*((int *)this + 135) * v20)),
1);
ERRCHECK_fn();
LABEL_18:
if ( v19 )
{
*((_DWORD *)this + 134) = FMOD::ChannelControl::addFadePoint(
v17,
(unsigned __int64)(float)((float)*(unsigned __int64 *)v28
+ (float)((float)*((int *)this + 135)
* (float)(v20 - (float)((float)a5 / 1000.0)))),
1.0);
ERRCHECK_fn();
*((_DWORD *)this + 134) = FMOD::ChannelControl::addFadePoint(
v17,
(unsigned __int64)(float)((float)*(unsigned __int64 *)v28
+ (float)((float)*((int *)this + 135) * v20)),
0.0);
ERRCHECK_fn();
}
goto LABEL_6;
}
LABEL_36:
v20 = (float)((float)(int)(v24 - a2) / v25) / 1000.0;
goto LABEL_18;
}
if ( a5 > 0 )
{
LABEL_16:
if ( a3 )
{
v20 = (float)((float)a3 / v25) / 1000.0;
goto LABEL_18;
}
goto LABEL_36;
}
}
else
{
if ( a5 > 0 )
{
*((_DWORD *)this + 134) = FMOD::ChannelControl::getDSPClock(v17, nullptr, (unsigned __int64 *)v28);
v19 = 1;
ERRCHECK_fn();
if ( !v14 )
goto LABEL_16;
LABEL_21:
if ( a3 > 0 || a2 > 0 )
{
if ( a3 <= 0 )
{
FMOD::Channel::getLoopPoints(v17, &v26, 1u, v28, 1u);
a3 = v28[0];
}
FMOD::Channel::setLoopPoints(v17, a2, 1u, a3, 1u);
}
goto LABEL_6;
}
if ( v14 )
goto LABEL_21;
}
}
}
LABEL_6:
if ( !v22 )
FMOD::ChannelControl::setPaused(v17, 0);
return _stack_chk_guard;
}