voice.playback.ShouldResync
voice.playback.ShouldResync
#Overview
name: voice.playback.ShouldResync
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If set to 1, we will resync VOIP audio once it\'s latency goes beyond voice.playback.ResyncThreshold.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of voice.playback.ShouldResync is to control the resyncing behavior of VOIP (Voice over IP) audio playback in Unreal Engine 5. This setting is specifically related to the voice communication system within the engine.
This setting variable is primarily used in the OnlineSubsystemUtils module, which is part of the online subsystem of Unreal Engine. It’s specifically utilized in the VoipListenerSynthComponent, which is responsible for handling VOIP audio playback.
The value of this variable is set through the Unreal Engine’s console variable system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using console commands.
The associated variable ShouldResyncCVar directly interacts with voice.playback.ShouldResync. They share the same value, with ShouldResyncCVar being the actual integer variable used in the C++ code.
Developers must be aware that this variable affects the audio synchronization of VOIP playback. When set to 1, the system will attempt to resync VOIP audio when its latency exceeds a certain threshold (defined by another variable, voice.playback.ResyncThreshold).
Best practices when using this variable include:
- Keeping it enabled (set to 1) in most cases to ensure smooth VOIP playback.
- Only disabling it (set to 0) if there are specific reasons to prevent audio resyncing.
- Monitoring its impact on VOIP quality and adjusting related settings (like ResyncThreshold) if necessary.
- Being cautious when changing this value during runtime, as it might affect ongoing voice communications.
Regarding the associated variable ShouldResyncCVar:
The purpose of ShouldResyncCVar is to provide a C++ accessible integer representation of the voice.playback.ShouldResync console variable. It allows for efficient checking of the resync setting within the C++ code without needing to query the console variable system repeatedly.
ShouldResyncCVar is used within the VoipListenerSynthComponent, specifically in the OnGenerateAudio function. This function is likely called frequently as part of the audio generation process.
The value of ShouldResyncCVar is set indirectly through the voice.playback.ShouldResync console variable. Any changes to the console variable will be reflected in ShouldResyncCVar.
Developers should be aware that ShouldResyncCVar is a static variable, meaning it’s shared across all instances of the VoipListenerSynthComponent. Changes to this variable will affect all VOIP playback in the game.
Best practices for ShouldResyncCVar include:
- Treat it as read-only within most of the code, changing its value only through the console variable system.
- Be aware of its static nature and the global impact of any changes.
- Use it for performance-critical checks where querying the console variable directly might be too slow.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoipListenerSynthComponent.cpp:29
Scope: file
Source code excerpt:
static int32 ShouldResyncCVar = 1;
FAutoConsoleVariableRef CVarShouldResync(
TEXT("voice.playback.ShouldResync"),
ShouldResyncCVar,
TEXT("If set to 1, we will resync VOIP audio once it's latency goes beyond voice.playback.ResyncThreshold.\n"),
ECVF_Default);
static int32 MuteAudioEngineOutputCVar = 0;
FAutoConsoleVariableRef CVarMuteAudioEngineOutput(
#Associated Variable and Callsites
This variable is associated with another variable named ShouldResyncCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoipListenerSynthComponent.cpp:27
Scope: file
Source code excerpt:
ECVF_Default);
static int32 ShouldResyncCVar = 1;
FAutoConsoleVariableRef CVarShouldResync(
TEXT("voice.playback.ShouldResync"),
ShouldResyncCVar,
TEXT("If set to 1, we will resync VOIP audio once it's latency goes beyond voice.playback.ResyncThreshold.\n"),
ECVF_Default);
static int32 MuteAudioEngineOutputCVar = 0;
FAutoConsoleVariableRef CVarMuteAudioEngineOutput(
TEXT("voice.MuteAudioEngineOutput"),
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoipListenerSynthComponent.cpp:74
Scope (from outer to inner):
file
function int32 UVoipListenerSynthComponent::OnGenerateAudio
Source code excerpt:
FScopeLock ScopeLock(&PacketBufferCriticalSection);
// Handle resync, if neccessary.
if (ShouldResyncCVar)
{
ForceResync();
}
PacketBuffer->PopAudio(OutAudio, NumSamples);
}