Audio device management
Allow players to select audio input and output devices.
Read time 2 minutesLast updated 2 days ago
The Vivox SDK automatically uses the system’s default audio input and output devices. You can override this behavior to give users a choice of which audio device to use for group voice chat, independent of the audio devices used for the game. To perform this override, build a user interface in the game that displays a list of available devices to users from which they can select a device. Build this user interface for InputDevices and OutputDevices, and utilize the
VivoxService.Instance.AvailableInputDevicesVivoxService.Instance.AvailableOutputDevicesVivoxInputDevicesVivoxOutputDevicesVivoxService.Instance.AvailableInputDevicesChangedVivoxService.Instance.AvailableOutputDevicesChangedVivoxService.Instance.AvailableInputDevicesVivoxService.Instance.AvailableOutputDevicesVivoxService.Instance.SetActiveInputDeviceAsync(VivoxInputDevice device)VivoxService.Instance.SetActiveOutputDeviceAsync(VivoxOutputDevice device)The Chat Channel Sample has an example of a UI object controlling the AudioDevice list inasync 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.csIdentify effective device
Participants can use a virtual device such asDefault System DeviceDefault Communication DeviceAs an example, when a player selects theVivoxService.Instance.EffectiveInputDeviceChanged;VivoxService.Instance.EffectiveOutputDeviceChanged;VivoxService.Instance.EffectiveInputDevice;VivoxService.Instance.EffectiveOutputDevice;
Default System DeviceDefault System DeviceVivoxService.Instance.EffectiveInputDevice
A screenshot of the Chat Channel Sample Audio Device Selection Menu with Effective Device Showing.
Default System DeviceDefault System Device