Defined in carb/audio/IAudioData.h

struct DecodeStateDesc

a descriptor of how to create a sound decode state object with createCodecState().

By separating this object from the sound data itself, this allows the sound to be trivially streamed or decoded to multiple voices simultaneously without having to worry about managing access to the sound data or loading it multiple times.

Public Members

DecodeStateFlags flags

flags to control the behavior of the decoder.

This may be 0 or a combination of the kDecodeState* flags.

SoundData *soundData

the sound data object to create the decoder state object for.

The size and content of the decoder object depends on the type of data contained within this object. This may not be nullptr. Note that in some cases, the format and length information in this object may be updated by the decoder. This would only occur in cases where the data were being streamed from disk. If streaming from memory the cached header information will be used instead. If this is used at load time (internally), the sound data object will always be modified to cache all the important information about the sound’s format and length.

SampleFormat outputFormat

the desired output format from the decoder.

This can be SampleFormat::eDefault to use the format from soundData; otherwise, this must be one of the SampleFormat::ePcm* formats.

void *readCallbackContext

an opaque context value that will be passed to the readCallback and setPosCallback functions each time they are called.

This value is a caller-specified object that is expected to contain the necessary decoding state for a user decoded stream. This value is only necessary if the fDataFlagUserDecode flag was used when the sound data object was created. By specifying this separately from the sound data, this allows multiple voices to be able to play a user decoded stream simultaneously. It is up to the caller to provide a unique decode state object here for each playing instance of the user decoded stream if there is an expectation of multiple instances.

void *ext

reserved for future expansion.

This must be set to nullptr.