OSS.VoiceLoopback

OSS.VoiceLoopback

#Overview

name: OSS.VoiceLoopback

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of OSS.VoiceLoopback is to enable or disable voice loopback functionality in the Online Subsystem of Unreal Engine 5. It is primarily used for testing and debugging voice communication features in multiplayer games or applications.

This setting variable is utilized by the Online Subsystem module, which is part of Unreal Engine’s networking and online services infrastructure. Specifically, it’s used within the voice communication system.

The value of this variable is set through a console variable (CVar) named CVarVoiceLoopback. It’s initialized with a default value of 0 (disabled) but can be changed at runtime through console commands or programmatically.

The associated variable CVarVoiceLoopback directly interacts with OSS.VoiceLoopback. They share the same value and purpose. CVarVoiceLoopback is the actual TAutoConsoleVariable object that stores and manages the voice loopback setting.

Developers should be aware that:

  1. This is a debugging feature and should not be enabled in production builds.
  2. When enabled (set to 1), it will cause the user’s voice input to be looped back as if it were coming from another player, which can be confusing for end-users.
  3. It may have performance implications if left enabled, especially in larger multiplayer scenarios.

Best practices for using this variable include:

  1. Use it only during development and testing phases.
  2. Ensure it’s disabled (set to 0) before releasing the game or application.
  3. Consider creating a debug menu or console command to toggle this feature easily during testing.
  4. Be cautious when using it in networked environments, as it might interfere with actual network voice communication testing.

Regarding the associated variable CVarVoiceLoopback: It serves as the actual implementation of the OSS.VoiceLoopback setting. It’s defined as a TAutoConsoleVariable, which means it can be easily accessed and modified at runtime. The variable is used in the VoiceInterfaceImpl.cpp file to conditionally add voice packets to the remote packets list when loopback is enabled. This allows developers to test voice transmission without the need for multiple clients or complex network setups.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Private/OnlineSubsystemImpl.cpp:21

Scope (from outer to inner):

file
namespace    OSSConsoleVariables

Source code excerpt:

	// CVars
	TAutoConsoleVariable<int32> CVarVoiceLoopback(
		TEXT("OSS.VoiceLoopback"),
		0,
		TEXT("Enables voice loopback\n")
		TEXT("1 Enabled. 0 Disabled."),
		ECVF_Default);
}

#Associated Variable and Callsites

This variable is associated with another variable named CVarVoiceLoopback. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Private/OnlineSubsystemImpl.cpp:20

Scope (from outer to inner):

file
namespace    OSSConsoleVariables

Source code excerpt:

{
	// CVars
	TAutoConsoleVariable<int32> CVarVoiceLoopback(
		TEXT("OSS.VoiceLoopback"),
		0,
		TEXT("Enables voice loopback\n")
		TEXT("1 Enabled. 0 Disabled."),
		ECVF_Default);
}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystem/Source/Public/OnlineSubsystemImpl.h:13

Scope (from outer to inner):

file
namespace    OSSConsoleVariables

Source code excerpt:

namespace OSSConsoleVariables
{
	extern ONLINESUBSYSTEM_API TAutoConsoleVariable<int32> CVarVoiceLoopback;
}

/**
 *	FOnlineSubsystemImpl - common functionality to share across online platforms, not intended for direct use
 */
class ONLINESUBSYSTEM_API FOnlineSubsystemImpl 

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

Scope: file

Source code excerpt:


#if VOICE_LOOPBACK
								if (OSSConsoleVariables::CVarVoiceLoopback.GetValueOnGameThread() && SpaceAvail > 0)
								{
									VoiceData.RemotePackets.Add(MakeShareable(new FVoicePacketImpl(VoiceData.LocalPackets[Index])));
								}
#endif
							}
							else