Documentation

Support

Vivox Unreal SDK

Vivox Unreal SDK

AVAudioSession configuration when using Wwise

Learn how to configure AVAudioSession when using Wwise.
Read time 1 minuteLast updated 2 days ago

If WWise is not configured correctly on iOS, Vivox and WWise can disagree on the configuration of
AVAudioSession
. A mismatch in the configuration can lead to a complete loss of voice chat functionality. Follow these steps to ensure WWise and Vivox align on the
AVAudioSession
configuration that will give you the best audio quality.

At game initialization

Configure WWise to ensure the
AVAudioSession
is in the Playback category with the default mode. This setting provides the highest-quality game audio. Additionally, the options are set to
AkAudioSessionCategoryOptionDefaultToSpeaker
and
AkAudioSessionCategoryOptionAllowBluetooth
to ensure that the audio goes through the device speakers or a Bluetooth device, whichever is available.
AkPlatformInitSettings platformInitSettings;AK::SoundEngine::GetDefaultPlatformInitSettings(platformInitSettings);platformInitSettings.audioSession.eCategory = AkAudioSessionCategory::AkAudioSessionCategoryPlayback;platformInitSettings.audioSession.eMode = AkAudioSessionMode::AkAudioSessionModeDefault;platformInitSettings.audioSession.eCategoryOptions = (AkAudioSessionCategoryOptions)(AkAudioSessionCategoryOptions::AkAudioSessionCategoryOptionDefaultToSpeaker | AkAudioSessionCategoryOptions::AkAudioSessionCategoryOptionAllowBluetooth);AK::SoundEngine::iOS::ChangeAudioSessionProperties(platformInitSettings.audioSession);

Before a channel join

Before joining a Vivox channel, configure WWise to prepare its
AVAudioSession
for voice chat. The category switches to PlayAndRecord, and the mode switches to ModeVoiceChat to allow microphone recording. The options remain the same, so the correct device is used (speaker or Bluetooth, whichever is available).
AkPlatformInitSettings platformInitSettings;AK::SoundEngine::GetDefaultPlatformInitSettings(platformInitSettings);platformInitSettings.audioSession.eCategory = AkAudioSessionCategory::AkAudioSessionCategoryPlayAndRecord;platformInitSettings.audioSession.eMode = AkAudioSessionMode::AkAudioSessionModeVoiceChat;platformInitSettings.audioSession.eCategoryOptions = (AkAudioSessionCategoryOptions)(AkAudioSessionCategoryOptions::AkAudioSessionCategoryOptionDefaultToSpeaker | AkAudioSessionCategoryOptions::AkAudioSessionCategoryOptionAllowBluetooth);AK::SoundEngine::iOS::ChangeAudioSessionProperties(platformInitSettings.audioSession);

After leaving a channel

After leaving a channel, reconfigure the
AVAudioSession
to its state at game initialization. This ensures that your game audio is of the highest quality.
AkPlatformInitSettings platformInitSettings;AK::SoundEngine::GetDefaultPlatformInitSettings(platformInitSettings);platformInitSettings.audioSession.eCategory = AkAudioSessionCategory::AkAudioSessionCategoryPlayback;platformInitSettings.audioSession.eMode = AkAudioSessionMode::AkAudioSessionModeDefault;platformInitSettings.audioSession.eCategoryOptions = (AkAudioSessionCategoryOptions)(AkAudioSessionCategoryOptions::AkAudioSessionCategoryOptionDefaultToSpeaker | AkAudioSessionCategoryOptions::AkAudioSessionCategoryOptionAllowBluetooth);AK::SoundEngine::iOS::ChangeAudioSessionProperties(platformInitSettings.audioSession);