Table of Contents
Codec plug-ins are used to provide the opportunity to leave out some audio file formats (such as ADPCM, PCM, Vorbis, and so on) at compilation time to reduce the memory footprint of the sound engine. This document contains the necessary information to allow developers to use a given codec format in their game.
Note: The Vorbis format is the only codec that currently supports pluggable behavior.
If a sound designer decides to use a codec format in the Wwise project for your game, its decompression plug-in needs to be integrated into your code to be available to the sound engine at runtime.
Each codec plug-in is provided as an individual library (.lib file) that must be linked into your game. For example the Vorbis format decoder library is AkVorbisDecoder.lib. You will also need to register the codec format using the AK::SoundEngine::RegisterCodec() SDK function (see Registering Codec Plug-Ins).
For platforms supporting dynamic libraries (such as the PC), the AkSoundEngineDLL project allows you to compile a bundle of all sound engine modules. By default, this project registers the Vorbis codec and links with its static library. If you wish not to use the Vorbis codec in your game, you may simply remove the link dependency on AkVorbisDecoder.lib from the project and comment out the registration of the codec plug-in in the sound engine initialization function. (Refer to Registering Codec Plug-Ins for more information.)
A codec plug-in must be registered by your game code before it can be used. Registering a codec plug-in is done with a call to AK::SoundEngine::RegisterCodec(), which is defined as follows:
// Register codec plug-in to the plugin manager and set callbacks to create new file source or bank source node. AKRESULT RegisterCodec( AkUInt32 in_ulCompanyID, // Company identifier (as declared in the plug-in description XML file) AkUInt32 in_ulCodecID, // Plugin identifier (as declared in the plug-in description XML file) AkCreateFileSourceCallback in_pFileCreateFunc, // Pointer to the codec file source creation function AkCreateBankSourceCallback in_pBankCreateFunc // Pointer to the codec bank source creation function ) = 0;
The first and second parameters are used to uniquely identify the codec plug-in you are registering. The Company ID and Plug-in ID are defined by the plug-in developer. For example, refer to "AK/Plugin/AkVorbisFactory.h" in the SDK for the Vorbis codec format. The third and fourth parameters are used by the sound engine to create an instance of the codec plug-in for either a source playback from memory or from a streamed file.
Note: Registering a codec plug-in needs to be done only once at initialization time.
Here is some example code for registering the Vorbis codec format.