Firelight Technologies FMOD Studio API
Retrieves the state a sound is in after FMOD_NONBLOCKING has been used to open it, or the state of the streaming buffer.
FMOD_RESULT Sound::getOpenState(
FMOD_OPENSTATE *openstate,
unsigned int *percentbuffered,
bool *starving,
bool *diskbusy
);
FMOD_RESULT FMOD_Sound_GetOpenState(
FMOD_SOUND *sound,
FMOD_OPENSTATE *openstate,
unsigned int *percentbuffered,
FMOD_BOOL *starving,
FMOD_BOOL *diskbusy
);
If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.
When a sound is opened with FMOD_NONBLOCKING, it is opened and prepared in the background, or asynchronously.
This allows the main application to execute without stalling on audio loads.
This function will describe the state of the asynchronous load routine i.e. whether it has succeeded, failed or is still in progress.
If 'starving' is true, then you will most likely hear a stuttering/repeating sound as the decode buffer loops on itself and replays old data.
Now that this variable exists, you can detect buffer underrun and use something like Channel::setMute to keep it quiet until it is not starving any more.
Note: Always check 'openstate' to determine the state of the sound. Do not assume that if this function returns FMOD_OK then the sound has finished loading.
Version 1.03.06 Built on Apr 17, 2014