Documentation

Support

Vivox Unreal SDK

Vivox Unreal SDK

In-game control of audio levels

Allow players to control voice and audio levels in-game.
Read time 1 minuteLast 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.
Volume settings adjust the apparent loudness of a device or participant. Volume settings have a settable range between -50 to 50 on a logarithmic scale, with +0db (no change) being at 0. Because it is a logarithmic scale, the usable range is generally between -10 and 25, with 25 tending to result in over modulation on a capture device and possible user discomfort on a headset. Note that any increase in the volume above the default value can introduce some amount of distortion, although this is less noticeable at lower levels. In the Vivox Unreal SDK, use
IAudioDevices::SetVolumeAdjustment(int value)
to allow users to change the gain (volume) of their audio device.
The following code displays an example of an implementation for setting both input and output audio levels:
void AdjustOutputVolume(int value){ VivoxVoiceClient.AudioOutputDevices().SetVolumeAdjustment(value);}void AdjustInputVolume(int value){ VivoxVoiceClient.AudioInputDevices().SetVolumeAdjustment(value);}
In the Vivox Unreal SDK, use
IParticipantProperties::BeginSetLocalVolumeAdjustment
to allow users to change the volume of a participant within a channel.
The following code displays an example of an implementation for setting another participant's volume:
void AdjustParticipantVolume(IParticipant &participant, int value){ IParticipant::FOnBeginSetLocalVolumeAdjustmentCompletedDelegate BeginSetLocalVolumeCompletedCallback; bool IsVolumeAdjusted = false; BeginSetLocalVolumeCompletedCallback.BindLambda([this, &IsVolumeAdjusted](VivoxCoreError Status) { if(VxErrorSuccess ==Status) { IsVolumeAdjusted = true; } }); participant.BeginSetLocalVolumeAdjustment(value,BeginSetLocalVolumeCompletedCallback);}