Firelight Technologies FMOD Studio API
FMOD_CODEC_READ_CALLBACK
Read callback for the codec for when FMOD tries to read some data from the file to the destination format (format specified in the open callback).
C/C++ Syntax
FMOD_RESULT F_CALLBACK FMOD_CODEC_READ_CALLBACK(
FMOD_CODEC_STATE *codec_state,
void *buffer,
unsigned int samples_in,
unsigned int *samples_out
);
Parameters
codec_state
Pointer to the codec state. The user can use this variable to access runtime plugin specific variables and plugin writer user data.
buffer
Buffer to read PCM data to. Note that the format of this data is the format described in FMOD_CODEC_WAVEFORMAT.
samples_in
Number of PCM samples to decode
samples_out
Number of PCM samples decoded
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
If you cannot read number of samples requested, simply return FMOD_OK and give samples_out the number of samples you decoded.
Read and seek within the file using the 'fileread' and 'fileseek' members of the FMOD_CODEC codec that is passed in.
Note: DO NOT USE YOUR OWN FILESYSTEM.
The reasons for this are:
- The user may have set their own file system via user filesystem callbacks.
- FMOD allows file reading via disk, memory and TCP/IP. If you use your own file routines you will lose this ability.
Remember to return FMOD_OK at the bottom of the function, or an appropriate error code from FMOD_RESULT.
See Also
- FMOD_CODEC_STATE
- FMOD_CODEC_DESCRIPTION
- FMOD_CODEC_OPEN_CALLBACK
- FMOD_CODEC_CLOSE_CALLBACK
- FMOD_CODEC_GETLENGTH_CALLBACK
- FMOD_CODEC_SETPOSITION_CALLBACK
- FMOD_CODEC_GETPOSITION_CALLBACK
- FMOD_CODEC_SOUNDCREATE_CALLBACK
Version 1.10.03 Built on Feb 1, 2018