FMOD_FILE_ASYNCREAD_CALLBACK

FMOD Studio API

Firelight Technologies FMOD Studio API

FMOD_FILE_ASYNCREAD_CALLBACK

Callback for reading from a file asynchronously. Different to FMOD_FILE_READ_CALLBACK in that this function can be returned from immediately without supplying any data, which will simply cause FMOD to wait internally for data.
The user will fill out the writeable variables in the FMOD_ASYNCREADINFO structure (in any thread), and when the FMOD_ASYNCREADINFO::result field is set to something other than FMOD_ERR_NOTREADY then it will continue.

C/C++ Syntax

FMOD_RESULT F_CALLBACK FMOD_FILE_ASYNCREAD_CALLBACK(
  FMOD_ASYNCREADINFO *info,
  void *userdata
);

Parameters

info

Pointer to FMOD_ASYNCREADINFO structure. Use this structure for your own system, to obtain the pointer to write to and number of bytes to read, as well as other information.

userdata

Userdata from FMOD_CREATESOUNDEXINFO.fileuserdata or FMOD_STUDIO_BANK_INFO.userData.

Return Values

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.

Remarks

To return immediately, return FMOD_OK.
If during your code path, there was a fatal error, for example if you ran out of memory return FMOD_ERR_MEMORY and this will cause FMOD to stop what it was trying to do and return the error back to the caller.
NOTE: If userasyncread is processed in the main thread, then it will hang the application, because FMOD will wait internally until data is ready, and the main thread process will not be able to supply the data. For this reason the user's file access should normally be from a separate thread.

See Also




Version 1.10.03 Built on Feb 1, 2018