bHasVoiceEnabled

bHasVoiceEnabled

#Overview

name: bHasVoiceEnabled

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bHasVoiceEnabled is to control whether voice communication features are enabled in the Unreal Engine’s online subsystem. This setting variable is primarily used for managing voice-related functionality in online multiplayer games.

The Unreal Engine subsystems that rely on this setting variable are primarily the Online Subsystem and its associated voice components. Specifically, it is used in the OnlineSubsystemOculus plugin and the OnlineSubsystemUtils module.

The value of this variable is typically set in the engine configuration file (GEngineIni). It is read from the [OnlineSubsystem] section of the configuration file using the GConfig->GetBool function.

This variable interacts with other voice-related settings and components in the engine. For example, in the OnlineSubsystemUtils, it is used alongside other voice settings like bDuckingOptOut.

Developers must be aware that this variable acts as a master switch for voice functionality. If set to false, voice features may be completely disabled regardless of other voice-related settings.

Best practices when using this variable include:

  1. Ensuring it is properly set in the engine configuration file for the desired behavior.
  2. Checking its value before initializing or using voice-related features in custom code.
  3. Considering platform-specific requirements or limitations when enabling voice features.
  4. Being aware that changing this setting may affect the user experience and network performance of the game.
  5. Implementing appropriate fallback behavior when voice is disabled.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:2227, section: [OnlineSubsystem]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemOculus/Source/Private/OnlineVoiceOculus.cpp:49

Scope (from outer to inner):

file
function     bool FOnlineVoiceOculus::Init

Source code excerpt:

bool FOnlineVoiceOculus::Init()
{
	bool bHasVoiceEnabled = false;
	if (GConfig->GetBool(TEXT("OnlineSubsystem"), TEXT("bHasVoiceEnabled"), bHasVoiceEnabled, GEngineIni) && bHasVoiceEnabled)
	{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
		VoipConnectionRequestDelegateHandle = OculusSubsystem.GetNotifDelegate(ovrMessage_Notification_Voip_ConnectRequest)
			.AddRaw(this, &FOnlineVoiceOculus::OnVoipConnectionRequest);

		VoipStateChangeDelegateHandle = OculusSubsystem.GetNotifDelegate(ovrMessage_Notification_Voip_StateChange)

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemOculus/Source/Private/OnlineVoiceOculus.cpp:65

Scope (from outer to inner):

file
function     bool FOnlineVoiceOculus::Init

Source code excerpt:

	}

	return bHasVoiceEnabled;
}

void FOnlineVoiceOculus::StartNetworkedVoice(uint8 LocalUserNum)
{
	if (LocalUserNum == 0)
	{

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/OnlineSubsystemUtils.cpp:376

Scope (from outer to inner):

file
function     bool HandleVoiceCommands

Source code excerpt:


		bool bHasVoiceInterfaceEnabled = false;
		if (!GConfig->GetBool(TEXT("OnlineSubsystem"), TEXT("bHasVoiceEnabled"), bHasVoiceInterfaceEnabled, GEngineIni))
		{
			UE_LOG_ONLINE_VOICE(Log, TEXT("Voice interface disabled by config [OnlineSubsystem].bHasVoiceEnabled"));
		}

		bool bDuckingOptOut = false;
		if (!GConfig->GetBool(TEXT("OnlineSubsystem"), TEXT("bDuckingOptOut"), bDuckingOptOut, GEngineIni))

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/VoiceInterfaceImpl.cpp:42

Scope (from outer to inner):

file
function     bool FOnlineVoiceImpl::Init

Source code excerpt:

	}

	bool bHasVoiceEnabled = false;
	if (GConfig->GetBool(TEXT("OnlineSubsystem"), TEXT("bHasVoiceEnabled"), bHasVoiceEnabled, GEngineIni) && bHasVoiceEnabled)
	{
		if (OnlineSubsystem)
		{
			SessionInt = OnlineSubsystem->GetSessionInterface().Get();
			IdentityInt = OnlineSubsystem->GetIdentityInterface().Get();
			bSuccess = SessionInt && IdentityInt;