Firelight Technologies FMOD Studio API
FMOD_CODEC_WAVEFORMAT
Set these values marked to tell fmod what sort of sound to create when the codec open callback is called.
The format, channels, frequency and lengthpcm tell FMOD what sort of sound buffer to create when you initialize your code.
If you wrote an MP3 codec that decoded to stereo 16bit integer PCM for a 44khz sound, you would specify FMOD_SOUND_FORMAT_PCM16, and channels would be equal to 2, and frequency would be 44100.
C/C++ Syntax
typedef struct {
const char* name;
FMOD_SOUND_FORMAT format;
int channels;
int frequency;
unsigned int lengthbytes;
unsigned int lengthpcm;
unsigned int pcmblocksize;
int loopstart;
int loopend;
FMOD_MODE mode;
FMOD_CHANNELMASK channelmask;
FMOD_CHANNELORDER channelorder;
float peakvolume;
} FMOD_CODEC_WAVEFORMAT;
JavaScript Syntax
struct FMOD_CODEC_WAVEFORMAT
{
name,
format,
channels,
frequency,
lengthbytes,
lengthpcm,
pcmblocksize,
loopstart,
loopend,
mode,
channelmask,
channelorder,
peakvolume,
};
Members
name
[w] Name of sound. Optional. If used, the codec must own the lifetime of the string memory until the codec is destroyed.
format
[w] Format for (decompressed) codec output, ie FMOD_SOUND_FORMAT_PCM8, FMOD_SOUND_FORMAT_PCM16. Mandantory - Must be supplied.
channels
[w] Number of channels used by codec, ie mono = 1, stereo = 2. Mandantory - Must be supplied.
frequency
[w] Default frequency in hz of the codec, ie 44100. Mandantory - Must be supplied.
lengthbytes
[w] Length in bytes of the source data. Used for FMOD_TIMEUNIT_RAWBYTES. Optional. Default = 0.
lengthpcm
[w] 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. Mandantory - Must be supplied.
pcmblocksize
[w] Minimum, optimal number of decompressed PCM samples codec can handle. 0 or 1 = no buffering. Anything higher means FMOD will allocate a PCM buffer of this size to read in chunks. The codec read callback will be called in multiples of this value. Optional.
loopstart
[w] Loopstart in decompressed, PCM samples of file. Optional. Default = 0.
loopend
[w] Loopend in decompressed, PCM samples of file. Optional. Default = 0.
mode
[w] Mode to determine whether the sound should by default load as looping, non looping, 2d or 3d. Optional. Default = FMOD_DEFAULT.
channelmask
[w] Defined channel bitmask to describe which speakers the channels in the codec map to, in order of channel count. See fmod_common.h. Optional. Leave at 0 to map to the speaker layout defined in FMOD_SPEAKER.
channelorder
[w] Defined channel order type, to describe where each sound channel should pan for the number of channels specified. See fmod_common.h. Optional. Leave at 0 to play in default speaker order.
peakvolume
[w] Peak volume of sound. Optional. Default = 0 if not used.
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.
1.07 Note. 'blockalign' member which was in bytes has been removed. 'pcmblocksize' is now the replacement, and is measured in PCM samples only, not bytes. This is purely to support buffering
internal to FMOD for codecs that are not sample accurate.
Note: When registering a codec, format, channels, frequency and lengthpcm must be supplied, otherwise there will be an error.
This structure is optional if FMOD_CODEC_GETWAVEFORMAT_CALLBACK is specified.
An array of these structures may be needed if FMOD_CODEC_STATE::numsubsounds is larger than 1.
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_WAVEFORMAT()", no 'new' keyword is required.
See Also
- FMOD_CODEC_STATE
- FMOD_SOUND_FORMAT
- FMOD_MODE
- FMOD_CHANNELMASK
- FMOD_CHANNELORDER
- FMOD_CODEC_WAVEFORMAT_VERSION
Version 1.10.03 Built on Feb 1, 2018