オーディオデバイスの管理
Allow players to select audio input and output devices.
読み終わるまでの所要時間 1 分最終更新 23日前
Vivox SDK では、システムのデフォルトのオーディオ入出力デバイスが自動的に使用されます。この動作をオーバーライドして、グループ音声チャットに使用するオーディオデバイスを、ゲームで使用されるオーディオデバイスとは別にユーザーが選択できるようにすることができます。 このオーバーライドを実行するには、利用可能なデバイスのリストをユーザーに表示するユーザーインターフェースをそのゲームにビルドし、ユーザーがそこからデバイスを選択できるようにします。このユーザーインターフェースを InputDevices と OutputDevices 用にビルドし、
VivoxService.Instance.AvailableInputDevicesVivoxService.Instance.AvailableOutputDevicesVivoxInputDevicesVivoxOutputDevicesVivoxService.Instance.AvailableInputDevicesChangedVivoxService.Instance.AvailableOutputDevicesChangedVivoxService.Instance.AvailableInputDevicesVivoxService.Instance.AvailableOutputDevicesivoxService.Instance.SetActiveInputDeviceAsync(VivoxInputDevice device)VivoxService.Instance.SetActiveOutputDeviceAsync(VivoxOutputDevice device)ChatChannelSample には、async void SetVivoxInputDeviceAsync(VivoxInputDevice device){ if(VivoxService.Instance.AvailableInputDevices.Contains(device)) { await VivoxService.Instance.SetActiveInputDeviceAsync(device); }}await void SetVivoxOutputDeviceAsync(VivoxInputDevice device){ if(VivoxService.Instance.AvailableOutputDevices.Contains(device)) { await VivoxService.Instance.SetActiveOutputDeviceAsync(device); }}
AudioDeviceSettings.cs有効なデバイスを識別する
参加者は、音声チャットを使用するときにアクティブなデバイスとしてDefault System DeviceDefault Communication Device例えば、プレイヤーがVivoxService.Instance.EffectiveInputDeviceChanged;VivoxService.Instance.EffectiveOutputDeviceChanged;VivoxService.Instance.EffectiveInputDevice;VivoxService.Instance.EffectiveOutputDevice;
Default System DeviceDefault System DeviceVivoxService.Instance.EffectiveInputDevice
Effective Device が表示されている Chat Channel Sample のオーディオデバイス選択メニューのスクリーンショット。
Default System DeviceDefault System Device