AVAudioSession configuration when using Wwise
Learn how to configure AVAudioSession when using Wwise.
読み終わるまでの所要時間 1 分最終更新 7ヶ月前
If WWise is not configured correctly on iOS, Vivox and WWise can disagree on the configuration of . 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 configuration that will give you the best audio quality.
AVAudioSessionAVAudioSessionAt game initialization
Configure WWise to ensure the is in the Playback category with the default mode. This setting provides the highest-quality game audio. Additionally, the options are set to and to ensure that the audio goes through the device speakers or a Bluetooth device, whichever is available.
AVAudioSessionAkAudioSessionCategoryOptionDefaultToSpeakerAkAudioSessionCategoryOptionAllowBluetoothAkPlatformInitSettings 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 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).
AVAudioSessionAkPlatformInitSettings 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 to its state at game initialization. This ensures that your game audio is of the highest quality.
AVAudioSessionAkPlatformInitSettings 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);