//
// FMODAudioEngine::waitUntilSoundReady from 0x10013e4f8 to 0x10013e590 (152 bytes)
//
// 2 xrefs:
// > FMODAudioEngine::setMusicTimeMS @ 0x10013aee0
// > FMODAudioEngine::preloadMusic @ 0x10013d4ec
//
// 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)
{
FMOD_OPENSTATE v2; // w20
unsigned int v8; // [xsp+Ch] [xbp-34h] BYREF
if ( !a2 )
return FMOD_OPENSTATE_ERROR;
do
{
a1->m_lastResult = FMOD::Sound::getOpenState(a2, (FMOD_OPENSTATE *)&v8, nullptr, nullptr, nullptr);
if ( v8 <= 6 && ((1 << v8) & 0x45) != 0 )
v2 = v8;
}
while ( v8 > 6 || ((1 << v8) & 0x45) == 0 );
return v2;
}