voice.debug.PrintAmplitude

voice.debug.PrintAmplitude

#Overview

name: voice.debug.PrintAmplitude

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of voice.debug.PrintAmplitude is to enable debugging for the voice capture system in Unreal Engine 5, specifically to display the current incoming amplitude of the VOIP (Voice over IP) engine on screen.

This setting variable is primarily used by the Voice module, which is part of the Online subsystem in Unreal Engine. It’s specifically utilized in the Windows implementation of voice capture, as evident from the file location (VoiceCaptureWindows.cpp).

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

The associated variable DisplayAmplitudeCvar interacts directly with voice.debug.PrintAmplitude. They share the same value, with DisplayAmplitudeCvar being the actual integer variable used in the code to check if amplitude printing is enabled.

Developers must be aware that this is a debugging feature and should not be enabled in production builds. It’s designed to help diagnose issues with voice capture and VOIP functionality during development.

Best practices when using this variable include:

  1. Only enable it when actively debugging voice capture issues.
  2. Be aware that displaying debug information on screen may impact performance.
  3. Use it in conjunction with other voice debugging tools for a comprehensive understanding of the voice system’s behavior.

Regarding the associated variable DisplayAmplitudeCvar:

The purpose of DisplayAmplitudeCvar is to serve as the actual integer variable that the code checks to determine whether to display the voice amplitude debug information.

It’s used directly in the Voice module, specifically in the Windows implementation of voice capture.

The value of DisplayAmplitudeCvar is set through the console variable system, mirroring the value of voice.debug.PrintAmplitude.

It interacts directly with voice.debug.PrintAmplitude, effectively serving as its in-code representation.

Developers should be aware that this variable is used in conditional statements to control the debug output. Changes to its value will immediately affect the debug display behavior.

Best practices for using DisplayAmplitudeCvar include:

  1. Treat it as read-only within the code, allowing it to be controlled solely through the console variable system.
  2. Use it for conditional checks rather than modifying its value directly in code.
  3. Be mindful of its performance impact when enabled, especially in performance-critical sections of code.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Online/Voice/Private/Windows/VoiceCaptureWindows.cpp:11

Scope: file

Source code excerpt:

static int32 DisplayAmplitudeCvar = 0;
FAutoConsoleVariableRef CVarDisplayAmplitude(
	TEXT("voice.debug.PrintAmplitude"),
	DisplayAmplitudeCvar,
	TEXT("when set to 1, the current incoming amplitude of the VOIP engine will be displayed on screen.\n")
	TEXT("0: disabled, 1: enabled."),
	ECVF_Default);

struct FVoiceCaptureWindowsVars

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Online/Voice/Private/Windows/VoiceCaptureWindows.cpp:9

Scope: file

Source code excerpt:

#include "Windows/AllowWindowsPlatformTypes.h"

static int32 DisplayAmplitudeCvar = 0;
FAutoConsoleVariableRef CVarDisplayAmplitude(
	TEXT("voice.debug.PrintAmplitude"),
	DisplayAmplitudeCvar,
	TEXT("when set to 1, the current incoming amplitude of the VOIP engine will be displayed on screen.\n")
	TEXT("0: disabled, 1: enabled."),
	ECVF_Default);

struct FVoiceCaptureWindowsVars
{

#Loc: <Workspace>/Engine/Source/Runtime/Online/Voice/Private/Windows/VoiceCaptureWindows.cpp:713

Scope (from outer to inner):

file
function     EVoiceCaptureState::Type FVoiceCaptureWindows::GetVoiceData

Source code excerpt:


	// print debug string with current amplitude:
	if (DisplayAmplitudeCvar && GEngine)
	{
		static double TimeLastPrinted = FPlatformTime::Seconds();

		static const double AmplitudeStringDisplayRate = 0.05;
		static const int32 TotalNumTicks = 32;