FMOD_CODEC_DESCRIPTION

FMOD Studio API

Firelight Technologies FMOD Studio API

FMOD_CODEC_DESCRIPTION

When creating a codec, declare one of these and provide the relevant callbacks and name for FMOD to use when it opens and reads a file.

C/C++ Syntax

typedef struct {
  const char *name;
  unsigned int version;
  int defaultasstream;
  FMOD_TIMEUNIT timeunits;
  FMOD_CODEC_OPEN_CALLBACK open;
  FMOD_CODEC_CLOSE_CALLBACK close;
  FMOD_CODEC_READ_CALLBACK read;
  FMOD_CODEC_GETLENGTH_CALLBACK getlength;
  FMOD_CODEC_SETPOSITION_CALLBACK setposition;
  FMOD_CODEC_GETPOSITION_CALLBACK getposition;
  FMOD_CODEC_SOUNDCREATE_CALLBACK soundcreate;
  FMOD_CODEC_GETWAVEFORMAT_CALLBACK getwaveformat;
} FMOD_CODEC_DESCRIPTION;

JavaScript Syntax

struct FMOD_CODEC_DESCRIPTION
{
  name,
  version,
  defaultasstream,
  timeunits,
  open,
  close,
  read,
  getlength,
  setposition,
  getposition,
  soundcreate,
  getwaveformat,
};

Members

name

[w] Name of the codec.

version

[w] Plugin writer's version number.

defaultasstream

[w] Tells FMOD to open the file as a stream when calling System::createSound, and not a static sample. Should normally be 0 (FALSE), because generally the user wants to decode the file into memory when using System::createSound. Mainly used for formats that decode for a very long time, or could use large amounts of memory when decoded. Usually sequenced formats such as mod/s3m/xm/it/midi fall into this category. It is mainly to stop users that don't know what they're doing from getting FMOD_ERR_MEMORY returned from createSound when they should have in fact called System::createStream or used FMOD_CREATESTREAM in System::createSound.

timeunits

[w] When setposition codec is called, only these time formats will be passed to the codec. Use bitwise OR to accumulate different types.

open

[w] Open callback for the codec for when FMOD tries to open a sound using this codec.

close

[w] Close callback for the codec for when FMOD tries to close a sound using this codec.

read

[w] Read callback for the codec for when FMOD tries to read some data from the file to the destination format (specified in the open callback).

getlength

[w] Callback to return the length of the song in whatever format required when Sound::getLength is called.

setposition

[w] Seek callback for the codec for when FMOD tries to seek within the file with Channel::setPosition.

getposition

[w] Tell callback for the codec for when FMOD tries to get the current position within the with Channel::getPosition.

soundcreate

[w] Sound creation callback for the codec when FMOD finishes creating the sound. (So the codec can set more parameters for the related created sound, ie loop points/mode or 3D attributes etc).

getwaveformat

[w] Callback to tell FMOD about the waveformat of a particular subsound. This is to save memory, rather than saving 1000 FMOD_CODEC_WAVEFORMAT structures in the codec, the codec might have a more optimal way of storing this information.

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.

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_DESCRIPTION()", no 'new' keyword is required.

See Also




Version 1.10.03 Built on Feb 1, 2018