//
// FMODAudioEngine::playEffectAdvanced from 0x3f0c80 to 0x3f13d4 (1876 bytes)
//
// 7 xrefs:
// > FMODAudioEngine::loadAudioState @ 0x3f147c
// > FMODAudioEngine::playUIEffect @ 0x3f17da
// > FMODAudioEngine::playEffectAsync @ 0x3f1852
// > FMODAudioEngine::playEffect @ 0x3f18cc
// > FMODAudioEngine::queuedEffectFinishedLoading @ 0x3f19f4
// > GameManager::playSFXTrigger @ 0x417db0
// > RewardUnlockLayer::playRewardEffect @ 0x618a1a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:47:14 +0000
//
int __fastcall FMODAudioEngine::playEffectAdvanced(
FMODAudioEngine *this,
unsigned __int8 *a2,
int a3,
int a4,
int a5,
float a6,
char a7,
unsigned __int8 a8,
int a9,
int a10,
int a11,
int a12,
char a13,
int a14,
unsigned __int8 a15,
char a16,
void *a17,
int a18,
float a19,
int a20)
{
int v20; // r5
float v24; // s18
unsigned int v25; // r6
int v26; // r11
float v27; // s16
int v28; // r4
_DWORD *MusicChannelID; // r0
FMOD::Channel *v30; // r0
unsigned int v31; // r2
float v32; // s20
FMOD::ChannelGroup **v33; // r0
unsigned int v34; // r7
FMOD::ChannelGroup *ChannelGroup; // r0
int v36; // r11
_DWORD *v37; // r0
int v38; // r9
int v39; // r11
int v40; // r10
unsigned int v41; // r8
unsigned int v42; // r9
unsigned int v43; // r10
_DWORD *v44; // r2
_DWORD *i; // r11
unsigned int v46; // r0
int v47; // r1
float v48; // s13
float v49; // s15
bool v50; // r5
unsigned int v51; // r5
unsigned int v52; // r1
_DWORD *v53; // r3
unsigned int v54; // r0
int v55; // r1
float v57; // r2
float v58; // s16
_BOOL4 isEffectLoaded; // [sp+44h] [bp-F0h]
FMOD::Sound *v61; // [sp+44h] [bp-F0h]
FMOD::System *v62; // [sp+4Ch] [bp-E8h]
unsigned int v63; // [sp+50h] [bp-E4h] BYREF
int v64; // [sp+54h] [bp-E0h] BYREF
FMOD::ChannelControl *v65; // [sp+58h] [bp-DCh] BYREF
FMOD::DSP *v66; // [sp+5Ch] [bp-D8h]
unsigned int v67; // [sp+60h] [bp-D4h] BYREF
int v68[3]; // [sp+64h] [bp-D0h] BYREF
unsigned __int64 v69; // [sp+70h] [bp-C4h] BYREF
int v70[6]; // [sp+80h] [bp-B4h] BYREF
char v71; // [sp+98h] [bp-9Ch]
int v72; // [sp+9Ch] [bp-98h]
int v73; // [sp+A0h] [bp-94h]
int v74; // [sp+D8h] [bp-5Ch]
int v75; // [sp+DCh] [bp-58h]
int v76; // [sp+E0h] [bp-54h]
int v77; // [sp+E4h] [bp-50h]
int v78; // [sp+E8h] [bp-4Ch]
int v79; // [sp+F0h] [bp-44h]
int v80; // [sp+F4h] [bp-40h]
int v81; // [sp+F8h] [bp-3Ch]
int v82; // [sp+FCh] [bp-38h]
int v83; // [sp+100h] [bp-34h]
int v84; // [sp+108h] [bp-2Ch]
int v85; // [sp+10Ch] [bp-28h]
float v86; // [sp+110h] [bp-24h]
char v87; // [sp+114h] [bp-20h]
unsigned __int8 v88; // [sp+115h] [bp-1Fh]
int v89; // [sp+118h] [bp-1Ch]
char v90; // [sp+11Ch] [bp-18h]
char v91; // [sp+124h] [bp-10h]
v24 = *(float *)&a5;
v25 = a10;
v26 = a15;
v27 = a19;
if ( *((float *)this + 82) <= 0.0 && !a13 )
return 0;
MusicChannelID = FMODAudioEngine::getMusicChannelID(this, 0, (unsigned int)&_stack_chk_guard);
v30 = (FMOD::Channel *)FMODAudioEngine::channelForChannelID(this, (unsigned int)MusicChannelID);
v63 = 0;
FMOD::Channel::getPosition(v30, &v63, 1u);
if ( a16 )
{
std::string::basic_string(v70, (int)a2);
isEffectLoaded = FMODAudioEngine::isEffectLoaded((int)this, (unsigned __int8 *)v70);
std::string::~string((int)v70);
if ( !isEffectLoaded )
{
std::string::basic_string(v70, (int)a2);
v28 = FMODAudioEngine::queuePlayEffect(
(int *)this,
(unsigned __int8 *)v70,
a3,
a4,
a5,
SLODWORD(a6),
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14,
v26,
a18,
SLODWORD(v27),
a20);
std::string::~string((int)v70);
return v28;
}
}
if ( v27 <= 0.0 )
{
LABEL_12:
v64 = 0;
if ( *(float *)&a5 > 2.0 )
v24 = 2.0;
if ( a14 )
v64 = (int)FMODAudioEngine::channelIDForUniqueID(this, a14, v31);
if ( v64 > 0 )
{
if ( !v26 )
return v64;
if ( FMODAudioEngine::isChannelStopping(this, v64, v31) )
{
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
(int *)this + 203,
(unsigned int *)&v64);
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
(int *)this + 208,
(unsigned int *)&a14);
}
else
{
FMODAudioEngine::stopChannel(this, v64);
}
v64 = 0;
}
std::string::basic_string(v70, (int)a2);
FMODAudioEngine::preloadEffect((int)this, (int)v70);
std::string::~string((int)v70);
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_DWORD *)this + 71,
a2) )
return 0;
v33 = (FMOD::ChannelGroup **)std::unordered_map::operator[]((int)this + 284, a2);
v65 = nullptr;
v62 = *((FMOD::System **)this + 91);
v34 = (unsigned int)v33;
v61 = *v33;
ChannelGroup = FMODAudioEngine::getChannelGroup(this, a20, (FMOD::ChannelGroup *)a8, *v33);
*((_DWORD *)this + 97) = FMOD::System::playSound(v62, v61, ChannelGroup, 1, &v65);
ERRCHECK_fn();
if ( *((_DWORD *)this + 97) )
return v64;
if ( *(float *)&a3 <= 0.0 )
*(float *)&a3 = 1.0;
FMOD::ChannelControl::setPitch(v65, *(float *)&a3);
FMOD::ChannelControl::setVolume(v65, v24);
if ( a13 )
FMOD::Channel::setLoopCount(v65, -1);
v66 = nullptr;
if ( a6 > 0.0 && a6 != 1.0 && *((_DWORD *)this + 190) <= 0x31u )
{
FMOD::System::createDSPByType();
FMOD::DSP::setParameterFloat(v66, 0, a6);
if ( a7 )
v57 = 2048.0;
else
v57 = 1024.0;
FMOD::DSP::setParameterFloat(v66, 1, v57);
FMOD::ChannelControl::addDSP(v65, 0, v66);
}
if ( a9 > 0 )
FMOD::Channel::setPosition(v65, a9, 1u);
if ( a10 <= 0 )
{
v36 = a10;
}
else
{
v36 = (a10 - a9) & ~((a10 - a9) >> 31);
if ( v36 )
{
LABEL_40:
*((_DWORD *)this + 97) = FMOD::ChannelControl::getDSPClock(v65, nullptr, &v69);
if ( a11 > 0 )
{
*((_DWORD *)this + 97) = FMOD::ChannelControl::addFadePoint(v65, v69, 0.0);
*((_DWORD *)this + 97) = FMOD::ChannelControl::addFadePoint(
v65,
(unsigned __int64)(float)((float)v69
+ (float)((float)*((int *)this + 98)
* (float)((float)a11 / 1000.0))),
1.0);
}
if ( v36 > 0 )
{
if ( !a13 )
{
v58 = (float)((float)v36 / *(float *)&a3) / 1000.0;
*((_DWORD *)this + 97) = FMOD::ChannelControl::setDelay(
v65,
0,
(unsigned __int64)(float)((float)v69 + (float)((float)*((int *)this + 98) * v58)),
1);
if ( a12 <= 0 )
goto LABEL_53;
goto LABEL_96;
}
LABEL_47:
if ( a9 > 0 )
{
if ( a10 <= 0 )
{
FMOD::Channel::getLoopPoints(v65, &v67, 1u, (unsigned int *)&v69, 1u);
v25 = v69;
}
}
else if ( a10 <= 0 )
{
LABEL_53:
FMOD::ChannelControl::setCallback();
v64 = (int)FMODAudioEngine::registerChannel(this, v65, a17, a14);
if ( v66 )
{
v37 = std::unordered_map::operator[]((int)this + 748, (unsigned int *)&v64);
*v37 = v66;
}
FMODAudioEngine::channelLinkSound((int)this, v64, v34);
std::string::basic_string(v68, (int)a2);
v38 = a14;
v39 = v64;
v40 = a18;
std::string::basic_string(v70, (int)v68);
v71 = a13;
v85 = a20;
v41 = *((_DWORD *)this + 178);
v89 = v38;
v87 = a7;
v70[3] = a3;
v72 = v39;
v73 = 0;
v70[4] = a4;
v74 = 0;
v75 = 0;
v76 = 0;
*(float *)&v70[5] = v24;
v77 = 0;
v78 = 0;
v79 = 0;
v80 = 0;
v81 = 0;
v82 = 0;
v83 = 0;
v84 = v40;
v86 = a6;
v88 = a8;
v90 = 0;
v91 = 0;
v42 = v64;
if ( v41 )
{
v43 = v41 - 1;
v20 = ((v41 - 1) & v41) != 0 ? v64 % v41 : v43 & v64;
v44 = *(_DWORD **)(*((_DWORD *)this + 177) + 4 * v20);
if ( v44 )
{
for ( i = (_DWORD *)*v44; i; i = (_DWORD *)*i )
{
v46 = i[1];
v47 = ((v41 - 1) & v41) != 0 ? v46 % v41 : v43 & v46;
if ( v47 != v20 )
break;
if ( i[2] == v64 )
goto LABEL_82;
}
}
}
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__construct_node_hash(
(int)&v69,
(int)this + 708,
v64,
&v64,
(int)v70);
v48 = *((float *)this + 181);
v49 = (float)(unsigned int)(*((_DWORD *)this + 180) + 1);
if ( v49 > (float)((float)v41 * v48) )
{
v50 = v41 > 2 && ((v41 - 1) & v41) == 0;
}
else
{
if ( v41 )
goto LABEL_74;
v50 = 0;
}
v51 = 2 * v41 + !v50;
v52 = (unsigned int)ceilf(v49 / v48);
if ( v52 < v51 )
v52 = v51;
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::rehash(
(int)this + 708,
v52);
v41 = *((_DWORD *)this + 178);
if ( ((v41 - 1) & v41) != 0 )
v20 = v42 % v41;
else
v20 = (v41 - 1) & v42;
LABEL_74:
v53 = *(_DWORD **)(*((_DWORD *)this + 177) + 4 * v20);
if ( v53 )
{
*(_DWORD *)v69 = *v53;
*v53 = v69;
}
else
{
*(_DWORD *)v69 = *((_DWORD *)this + 179);
*((_DWORD *)this + 179) = v69;
*(_DWORD *)(*((_DWORD *)this + 177) + 4 * v20) = (char *)this + 716;
if ( *(_DWORD *)v69 )
{
v54 = *(_DWORD *)(*(_DWORD *)v69 + 4);
if ( ((v41 - 1) & v41) != 0 )
v55 = v54 % v41;
else
v55 = (v41 - 1) & v54;
*(_DWORD *)(*((_DWORD *)this + 177) + 4 * v55) = v69;
}
}
++*((_DWORD *)this + 180);
LABEL_82:
std::string::~string((int)v70);
std::string::~string((int)v68);
FMOD::ChannelControl::setVolumeRamp(v65, 0);
FMOD::ChannelControl::setPaused(v65, 0);
return v64;
}
FMOD::Channel::setLoopPoints(v65, a9, 1u, v25, 1u);
goto LABEL_53;
}
if ( a12 > 0 )
{
if ( !v36 )
v36 = *(_DWORD *)(v34 + 16) - a9;
if ( !a13 )
{
v58 = (float)((float)v36 / *(float *)&a3) / 1000.0;
LABEL_96:
*((_DWORD *)this + 97) = FMOD::ChannelControl::addFadePoint(
v65,
(unsigned __int64)(float)((float)v69
+ (float)((float)*((int *)this + 98)
* (float)(v58 - (float)((float)a12 / 1000.0)))),
1.0);
*((_DWORD *)this + 97) = FMOD::ChannelControl::addFadePoint(
v65,
(unsigned __int64)(float)((float)v69 + (float)((float)*((int *)this + 98) * v58)),
0.0);
goto LABEL_53;
}
goto LABEL_47;
}
LABEL_46:
if ( !a13 )
goto LABEL_53;
goto LABEL_47;
}
}
if ( a11 <= 0 && a12 <= 0 )
goto LABEL_46;
goto LABEL_40;
}
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_DWORD *)this + 162,
(unsigned int *)&a18)
|| (v32 = *((float *)this + 107),
(float)(v32 - *(float *)std::unordered_map::operator[]((int)this + 648, (unsigned int *)&a18)) >= v27) )
{
*std::unordered_map::operator[]((int)this + 648, (unsigned int *)&a18) = *((_DWORD *)this + 107);
goto LABEL_12;
}
return 0;
}