//
// FMODAudioEngine::waitUntilSoundReady from 0x1003e9720 to 0x1003e97b2 (146 bytes)
//
// 0 xrefs:
//
// 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
//
FMOD_OPENSTATE __fastcall FMODAudioEngine::waitUntilSoundReady(FMODAudioEngine *a1, FMOD::Sound *a2)
{
__int64 v2; // rax
__int64 v3; // r13
int v4; // r12d
FMOD_OPENSTATE result; // eax
FMOD_OPENSTATE v6; // [rsp-34h] [rbp-34h] BYREF
__int64 v7; // [rsp-20h] [rbp-20h]
if ( !a2 )
return FMOD_OPENSTATE_ERROR;
v7 = v3;
v6 = HIDWORD(v2);
v4 = 69;
do
{
do
{
a1->m_lastResult = FMOD::Sound::getOpenState(a2, &v6, nullptr, nullptr, nullptr);
if ( v6 <= FMOD_OPENSTATE_PLAYING )
{
result = v6;
if ( _bittest(&v4, v6) )
break;
}
result = (unsigned int)v3;
}
while ( v6 > FMOD_OPENSTATE_PLAYING );
LODWORD(v3) = result;
}
while ( !_bittest(&v4, v6) );
return result;
}