Version
menu_open
Wwise SDK 2023.1.4
Audio Input Source Plug-in

About this plug-in

This plug-in allows sound designers to use audio from an external source, for example a network stream, or a microphone connected to the PC or console.

Integrating the plug-in

Aside from regular plug-in initialization (see Integration Details - Plug-Ins), integrating the Audio Input plugin requires the game to provide input audio data used by the various instances of the plug-in in the Wwise project. This is done through a callback mechanism, as exposed in AkAudioInputSourceFactory.h:

  • At first, the game calls SetAudioInputCallbacks() to set the mandatory AkAudioInputPluginExecuteCallbackFunc which will be called whenever an instance of audio input requires more audio data.
    • If the audio data is not a mono stream of 32-bit floating point values, the AkAudioInputPluginGetFormatCallbackFunc must be set. This callback only accepts audio data in the following formats, where the left and right channels are stored as shown for a 16-frame buffer:

      • interleaved 16-bit integer (also known as planar)
      • non-interleaved 32-bit floating point

      AkAudioInputPluginGetFormatCallbackFunc uses AkAudioFormat which can be populated as shown in the example below. AkAudioFormat consists of audio data format specifications and channel configuration AkChannelConfig.

      AkChannelConfig can be set with the help of one of the calls mentioned below: AkChannelConfig.SetAnonymous(...), AkChannelConfig.SetStandard(...) or AkChannelConfig.SetAmbisonic(...)

      ChannelMask: There are no restrictions on channelmask. Standard and custom channelmasks are supported.

      Interleaved format (AK_INTERLEAVED) only supports AK_INT, and non-interleaved format (AK_NONINTERLEAVED) only supports AK_FLOAT.

AkAudioFormat audioFormat;
AkChannelConfig audioChConfig;
audioChConfig.SetStandard(0);
audioFormat.SetAll(
48000, // Sample rate
audioChConfig, // \ref AkChannelConfig
16, // Bits per samples
2, // 2 bytes per samples
AK_INT, // feeding integers(signed)
);

A very simple integration is demonstrated in the Microphone/AudioInput Demo demo, using a microphone as the input. In the Integration Demo Wwise Project, a Sound Voice named Microphone uses the Audio Input plug-in as a source.

Note: In Wwise, the audio input plugin is fed with audio from the microphone input of the PC. If no microphone is connected, it will be silent.
AkForceInline void SetStandard(AkUInt32 in_uChannelMask)
Set channel config as a standard configuration specified with given channel mask.
const AkDataTypeID AK_INT
Integer data type (uchar, short, and so on)
Definition: AkCommonDefs.h:50
Defines the parameters of an audio buffer format.
Definition: AkCommonDefs.h:63
const AkDataInterleaveID AK_INTERLEAVED
Interleaved data.
Definition: AkCommonDefs.h:53
void SetAll(AkUInt32 in_uSampleRate, AkChannelConfig in_channelConfig, AkUInt32 in_uBitsPerSample, AkUInt32 in_uBlockAlign, AkUInt32 in_uTypeID, AkUInt32 in_uInterleaveID)
Definition: AkCommonDefs.h:126

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise