voice.MuteAudioEngineOutput
voice.MuteAudioEngineOutput
#Overview
name: voice.MuteAudioEngineOutput
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When set to a nonzero value, the output for the audio engine will be muted..\n
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of voice.MuteAudioEngineOutput is to control the muting of the audio engine output for voice communication in Unreal Engine 5. This setting variable is primarily used in the voice communication system of the engine.
Based on the Callsites section, this setting variable is mainly used in the Online Subsystem Utils plugin, specifically in the VoiceEngineImpl and VoipListenerSynthComponent files. This suggests that the Unreal Engine’s voice communication subsystem relies on this variable.
The value of this variable is set through the console variable system. It can be set programmatically using the Set() method of the console variable, as seen in the PatchRemoteTalkerOutputToEndpoint and DisconnectAllEndpoints functions.
The associated variable MuteAudioEngineOutputCVar interacts directly with voice.MuteAudioEngineOutput. They share the same value, with MuteAudioEngineOutputCVar being used as an integer representation of the console variable.
Developers must be aware that setting this variable to a non-zero value will mute the audio engine output for voice communication. This can be useful for debugging or when implementing custom voice output systems.
Best practices when using this variable include:
- Use it cautiously, as muting the audio engine output can affect the user experience.
- Always ensure to reset the value to 0 when it’s no longer needed, as seen in the DisconnectAllEndpoints function.
- Consider the implications on multiplayer and networked games when modifying this variable.
Regarding the associated variable MuteAudioEngineOutputCVar:
The purpose of MuteAudioEngineOutputCVar is to provide a quick, in-memory access to the state of the voice.MuteAudioEngineOutput console variable.
This variable is used in the Online Subsystem Utils plugin, specifically in the VoipListenerSynthComponent.
The value of MuteAudioEngineOutputCVar is set when the console variable voice.MuteAudioEngineOutput is initialized, and it’s updated whenever the console variable changes.
It interacts directly with voice.MuteAudioEngineOutput, serving as its in-memory representation.
Developers should be aware that this variable is used to quickly check the mute state in performance-critical audio generation code, as seen in the OnGenerateAudio function.
Best practices include:
- Treat this variable as read-only in most cases, updating it only through the console variable system.
- Be cautious about introducing any race conditions if modifying this variable directly in multithreaded contexts.
#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:36
Scope: file
Source code excerpt:
static int32 MuteAudioEngineOutputCVar = 0;
FAutoConsoleVariableRef CVarMuteAudioEngineOutput(
TEXT("voice.MuteAudioEngineOutput"),
MuteAudioEngineOutputCVar,
TEXT("When set to a nonzero value, the output for the audio engine will be muted..\n"),
ECVF_Default);
static float ResyncThresholdCVar = 0.3f;
FAutoConsoleVariableRef CVarResyncThreshold(
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoiceEngineImpl.cpp:878
Scope (from outer to inner):
file
function bool FVoiceEngineImpl::PatchRemoteTalkerOutputToEndpoint
Source code excerpt:
if (bMuteInGameOutput)
{
static IConsoleVariable* MuteAudioEngineOutputCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("voice.MuteAudioEngineOutput"));
check(MuteAudioEngineOutputCVar);
MuteAudioEngineOutputCVar->Set(1, ECVF_SetByGameSetting);
}
TUniquePtr<FVoiceEndpoint>& Endpoint = ExternalEndpoints.Emplace_GetRef(new FVoiceEndpoint(InDeviceName, float(UVOIPStatics::GetVoiceSampleRate()), UVOIPStatics::GetVoiceNumChannels()));
Audio::FPatchOutputStrongPtr OutputPatch = AllRemoteTalkerAudio.AddNewOutput(4096 * 2, 1.0f);
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoiceEngineImpl.cpp:900
Scope (from outer to inner):
file
function void FVoiceEngineImpl::DisconnectAllEndpoints
Source code excerpt:
void FVoiceEngineImpl::DisconnectAllEndpoints()
{
static IConsoleVariable* MuteAudioEngineOutputCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("voice.MuteAudioEngineOutput"));
check(MuteAudioEngineOutputCVar);
MuteAudioEngineOutputCVar->Set(0, ECVF_SetByGameSetting);
ExternalEndpoints.Reset();
}
#Associated Variable and Callsites
This variable is associated with another variable named MuteAudioEngineOutputCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoiceEngineImpl.cpp:878
Scope (from outer to inner):
file
function bool FVoiceEngineImpl::PatchRemoteTalkerOutputToEndpoint
Source code excerpt:
if (bMuteInGameOutput)
{
static IConsoleVariable* MuteAudioEngineOutputCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("voice.MuteAudioEngineOutput"));
check(MuteAudioEngineOutputCVar);
MuteAudioEngineOutputCVar->Set(1, ECVF_SetByGameSetting);
}
TUniquePtr<FVoiceEndpoint>& Endpoint = ExternalEndpoints.Emplace_GetRef(new FVoiceEndpoint(InDeviceName, float(UVOIPStatics::GetVoiceSampleRate()), UVOIPStatics::GetVoiceNumChannels()));
Audio::FPatchOutputStrongPtr OutputPatch = AllRemoteTalkerAudio.AddNewOutput(4096 * 2, 1.0f);
Endpoint->PatchInOutput(OutputPatch);
return true;
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoiceEngineImpl.cpp:900
Scope (from outer to inner):
file
function void FVoiceEngineImpl::DisconnectAllEndpoints
Source code excerpt:
void FVoiceEngineImpl::DisconnectAllEndpoints()
{
static IConsoleVariable* MuteAudioEngineOutputCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("voice.MuteAudioEngineOutput"));
check(MuteAudioEngineOutputCVar);
MuteAudioEngineOutputCVar->Set(0, ECVF_SetByGameSetting);
ExternalEndpoints.Reset();
}
int32 FVoiceEngineImpl::GetMaxVoiceRemainderSize()
{
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoipListenerSynthComponent.cpp:34
Scope: file
Source code excerpt:
ECVF_Default);
static int32 MuteAudioEngineOutputCVar = 0;
FAutoConsoleVariableRef CVarMuteAudioEngineOutput(
TEXT("voice.MuteAudioEngineOutput"),
MuteAudioEngineOutputCVar,
TEXT("When set to a nonzero value, the output for the audio engine will be muted..\n"),
ECVF_Default);
static float ResyncThresholdCVar = 0.3f;
FAutoConsoleVariableRef CVarResyncThreshold(
TEXT("voice.playback.ResyncThreshold"),
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoipListenerSynthComponent.cpp:95
Scope (from outer to inner):
file
function int32 UVoipListenerSynthComponent::OnGenerateAudio
Source code excerpt:
}
if (MuteAudioEngineOutputCVar)
{
FMemory::Memzero(OutAudio, NumSamples * sizeof(float));
}
return NumSamples;
}