Table des matières

MP3 Source Plug-in

About this plug-in

This sample plug-in allows you to play back a game player's MP3 files at runtime. You can use this source plug-in if you want to give the game player the option to replace the game music with their own MP3 files. When using this plug-in, a game player's MP3 files can be sent through the Wwise pipeline at runtime and processed by the sound engine. This means you can take full advantage of all the features and effect processing in Wwise.

Integrating the Plug-in

Aside from the usual plug-in initialization (see Integration Details - Plug-Ins), integrating the MP3 Source plug-in requires that the game provides the full path of the MP3 file that will be played.

To facilitate this, two extra methods are exposed in AkMP3SourceFactory.h:

  • AkMP3InfoRead() allows you to parse the MP3 file to get its base information. This method must be called prior to calling AkMP3PrepareForPlayback with the correct information.
  • AkMP3PrepareForPlayback() allows you to determine which MP3 file will be played. This method must be called before playing the Wwise event that plays the game player's MP3s).

The current sample plugin allows you to prepare only one MP3 file at a time. Scrolling through a sound can be achieved by calling AkMP3PrepareForPlayback() with a new offset, and then stopping and then playing the same sound again using a Wwise event.

Unlike the other plug-ins, this plug-in will not search in the bank or streamed files directory. Since the MP3 is located on the game player's computer, the MP3's full path will be required so that the sound engine can prepare the sounds to be played. The sample file includes a special case: \samples\SoundEngine\Common\AkFileLocationBase.cpp, which allows this plug-in to use the streaming manager while using a complete path.