FMOD_CODEC_STATE

FMOD Studio API

Firelight Technologies FMOD Studio API

FMOD_CODEC_STATE

Codec plugin structure that is passed into each callback.

Optionally set the numsubsounds and waveformat members when called in FMOD_CODEC_OPEN_CALLBACK to tell fmod what sort of sound to create.

C/C++ Syntax

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;

JavaScript Syntax

struct FMOD_CODEC_STATE
{
  numsubsounds,
  plugindata,
  filehandle,
  filesize,
  fileread,
  fileseek,
  metadata,
  waveformatversion,
};

Members

numsubsounds

[w] 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

[w] 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

[w] Plugin writer created data the codec author wants to attach to this object.

filehandle

[r] This will return an internal FMOD file handle to use with the callbacks provided.

filesize

[r] This will contain the size of the file in bytes.

fileread

[r] This will return a callable FMOD file function to use from codec.

fileseek

[r] This will return a callable FMOD file function to use from codec.

metadata

[r] This will return a callable FMOD metadata function to use from codec.

waveformatversion

[w] Must be set to FMOD_CODEC_WAVEFORMAT_VERSION in the FMOD_CODEC_OPEN_CALLBACK.

Remarks

Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
Members marked with [w] mean the variable can be written to. The user can set the value.

'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 waveformat value should point to an 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 waveformat, the same as if the number of subsounds was 1. If subsounds was 100 for example, there should be a pointer to an array of 100 waveformat structures.

The waveformat pointer is optional and could be 0, if using FMOD_CODEC_GETWAVEFORMAT_CALLBACK is preferred.

When a sound has 1 or more subsounds, the caller must play the individual sounds specified by first obtaining the subsound with Sound::getSubSound.

JavaScript only :

Not all fields are currently supported or may not work as expected at this time. To initialize an new instance in javascript use "FMOD.CODEC_STATE()", no 'new' keyword is required.

See Also




Version 1.10.03 Built on Feb 1, 2018