Firelight Technologies FMOD Studio API

FMOD_CODEC_WAVEFORMAT

Set these values marked 'in' 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.
Members marked as 'out' are set by fmod. Do not modify these. Simply specify 0 for these values when declaring the structure, FMOD will fill in the values for you after creation with the correct function pointers.

Structure

typedef struct {
  char name[256];
  FMOD_SOUND_FORMAT format;
  int channels;
  int frequency;
  unsigned int lengthbytes;
  unsigned int lengthpcm;
  int blockalign;
  int loopstart;
  int loopend;
  FMOD_MODE mode;
  FMOD_CHANNELMASK channelmask;
  FMOD_CHANNELORDER channelorder;
  float peakvolume;
} FMOD_CODEC_WAVEFORMAT;

Members

name

[in] Name of sound.

format

[in] Format for (decompressed) codec output, ie FMOD_SOUND_FORMAT_PCM8, FMOD_SOUND_FORMAT_PCM16.

channels

[in] Number of channels used by codec, ie mono = 1, stereo = 2.

frequency

[in] Default frequency in hz of the codec, ie 44100.

lengthbytes

[in] Length in bytes of the source data.

lengthpcm

[in] Length in decompressed, PCM samples of the file, ie length in seconds * frequency. Used for Sound::getLength and for memory allocation of static decompressed sample data.

blockalign

[in] Blockalign in decompressed, PCM samples of the optimal decode chunk size for this format. The codec read callback will be called in multiples of this value.

loopstart

[in] Loopstart in decompressed, PCM samples of file.

loopend

[in] Loopend in decompressed, PCM samples of file.

mode

[in] Mode to determine whether the sound should by default load as looping, non looping, 2d or 3d.

channelmask

[in] Defined channel bitmask to describe which speakers the channels in the codec map to, in order of channel count. See fmod_common.h. Leave at 0 to map to the speaker layout defined in FMOD_SPEAKER.

channelorder

[in] Defined channel order type, to describe where each sound channel should pan for the number of channels specified. See fmod_common.h. Leave at 0 to play in default speaker order.

peakvolume

[in] Peak volume of sound, or 0 if not used.

Remarks

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 network, 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), MIDI/MOD/S3M/XM/IT (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.

See Also




Version 1.03.06 Built on Apr 17, 2014