In-game control of audio levels
Allow players to control voice and audio levels in-game.
Read time 2 minutesLast updated 2 days ago
You can use the Vivox SDK to allow in-game control for audio input and output levels. The following list details examples of scenarios in which you would want to implement in-game control of audio levels:
- A user wants game sounds and voice output to have different volume levels.
- One user is playing music in the background, and another user wants to reduce the audio volume that is playing.
Adjust local user input and output device volume
The Vivox Unity SDK uses the following methods for setting input and output device audio levels:-
VivoxService.Instance.SetInputDeviceVolume(int value)- Sets the client-side volume of the input device (microphone).
- You can set this value to anything between -50 and 50, with negative numbers lowering the volume, and positive numbers raising the volume.
- This value affects all channels.
-
VivoxService.Instance.SetOutputDeviceVolume(int value)- Sets the client-side volume for all Vivox voice audio playing through audio devices on a computer.
- You can set this value to anything between -50 and 50, with negative numbers lowering the volume, and positive numbers raising the volume.
- This value affects all channels.
Adjust a channel participant's volume
The Vivox Unity SDK uses the following method for setting the volume of individual players that a user is in a channel with:VivoxParticipant.SetLocalVolume(int volume)- Sets the client-side volume for the Vivox voice audio of an individual participant in a channel.
- You can set this value to anything between -50 and 50, with negative numbers lowering participants volume, and positive numbers raising participant volume.
- For information on objects, refer to the Participant management documentation.
VivoxParticipant
Adjust the volume of a channel
The Vivox Unity SDK uses the following method for setting the volume of a channel:VivoxService.Instance.SetChannelVolumeAsync(string channelName, int value)- Sets the client-side volume for all Vivox voice audio playing through a specific channel.
- You can set this value to anything between -50 and 50, with negative numbers lowering the volume of all incoming audio from a channel, and positive numbers raising the volume.