Firelight Technologies FMOD Studio API
Codec plugin structure that is passed into each callback.
Set these numsubsounds and waveformat members when called in FMOD_CODEC_OPEN_CALLBACK to tell fmod what sort of sound to create.
The format, channels and frequency tell FMOD what sort of hardware buffer to create when you initialize your code. So if you wrote an MP3 codec that decoded to stereo 16bit integer PCM, you would specify FMOD_SOUND_FORMAT_PCM16, and channels would be equal to 2.
typedef struct {
int numsubsounds;
FMOD_CODEC_WAVEFORMAT *waveformat;
void *plugindata;
void *filehandle;
unsigned int filesize;
FMOD_FILE_READ_CALLBACK fileread;
FMOD_FILE_SEEK_CALLBACK fileseek;
FMOD_CODEC_METADATA_CALLBACK metadata;
int waveformatversion;
} FMOD_CODEC_STATE;
numsubsounds
[in] Number of 'subsounds' in this sound. Anything other than 0 makes it a 'container' format (ie DLS/FSB etc which contain 1 or more subsounds). For most normal, single sound codec such as WAV/AIFF/MP3, this should be 0 as they are not a container for subsounds, they are the sound by itself.
waveformat
[in] Pointer to an array of format structures containing information about each sample. Can be 0 or NULL if FMOD_CODEC_GETWAVEFORMAT_CALLBACK callback is preferred. The number of entries here must equal the number of subsounds defined in the subsound parameter. If numsubsounds = 0 then there should be 1 instance of this structure.
plugindata
[in] Plugin writer created data the codec author wants to attach to this object.
filehandle
[out] This will return an internal FMOD file handle to use with the callbacks provided.
filesize
[out] This will contain the size of the file in bytes.
fileread
[out] This will return a callable FMOD file function to use from codec.
fileseek
[out] This will return a callable FMOD file function to use from codec.
metadata
[out] This will return a callable FMOD metadata function to use from codec.
waveformatversion
[in] Must be set to FMOD_CODEC_WAVEFORMAT_VERSION in the FMOD_CODEC_OPEN_CALLBACK.
Members marked with [in] mean the variable can be written to. The user can set the value.
Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
An FMOD file might be from disk, memory or internet, however the file may be opened by the user.
'numsubsounds' should be 0 if the file is a normal single sound stream or sound. Examples of this would be .WAV, .WMA, .MP3, .AIFF.
'numsubsounds' should be 1+ if the file is a container format, and does not contain wav data itself. Examples of these types would be FSB (contains multiple sounds), DLS (contain instruments).
The arrays of format, channel, frequency, length and blockalign should point to arrays of information based on how many subsounds are in the format. If the number of subsounds is 0 then it should point to 1 of each attribute, the same as if the number of subsounds was 1. If subsounds was 100 for example, each pointer should point to an array of 100 of each attribute.
When a sound has 1 or more subsounds, you must play the individual sounds specified by first obtaining the subsound with Sound::getSubSound.
Version 1.03.06 Built on Apr 17, 2014