//
// GJBaseGameLayer::applySFXEditTrigger from 0x140242130 to 0x140242318 (488 bytes)
//
// 6 xrefs:
// > GJBaseGameLayer::processQueuedAudioTriggers @ 0x14023bbc8
// > GJBaseGameLayer::activateSongEditTrigger @ 0x1402419d1
// > GJBaseGameLayer::activateSFXEditTrigger @ 0x140241feb
// > GJBaseGameLayer::activateSFXEditTrigger @ 0x14024207f
// > GJBaseGameLayer::activateSFXEditTrigger @ 0x14024210a
// > ??> @ 0x1406ce478
//
// 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
//
// Hidden C++ exception states: #wind=4
void GJBaseGameLayer::applySFXEditTrigger(GJBaseGameLayer *a1, int a2, int a3, SFXTriggerGameObject *a4)
{
FMODAudioEngine *v7; // rcx
float m_pitch; // xmm6_4
FMODAudioEngine *v9; // rcx
FMODAudioEngine *v10; // [rsp+60h] [rbp+8h]
FMODAudioEngine *v11; // [rsp+60h] [rbp+8h]
FMODAudioEngine *v12; // [rsp+60h] [rbp+8h]
FMODAudioEngine *v13; // [rsp+60h] [rbp+8h]
if ( a1->m_practiceMusicSync || !a1->m_isPracticeMode || a1->m_isPlatformer )
{
if ( a4->m_stop || a4->m_stopLoop )
{
v7 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v10 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v7 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::stopChannel(v7, a2, (AudioTargetType)a3, a4->m_stopLoop, 0.0);
}
if ( a4->m_changeVolume )
{
m_pitch = a4->m_pitch;
if ( m_pitch <= 0.0 )
{
if ( !qword_1406C2E88 )
{
v11 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
}
m_pitch = FMODAudioEngine::pitchForIdx(a4->m_speed);
}
if ( !qword_1406C2E88 )
{
v12 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
}
FMODAudioEngine::updateChannel(
(FMODAudioEngine *)qword_1406C2E88,
a2,
(AudioTargetType)a3,
Pitch,
a4->m_duration,
m_pitch);
}
if ( a4->m_changeSpeed )
{
v9 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v13 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v9 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::updateChannel(v9, a2, (AudioTargetType)a3, Volume, a4->m_duration, a4->m_volume);
}
}
}