au.Debug.Sounds.Max

au.Debug.Sounds.Max

#Overview

name: au.Debug.Sounds.Max

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 au.Debug.Sounds.Max is to control the maximum number of sounds displayed in the full sound debugger view in Unreal Engine 5. This setting is primarily used for debugging and profiling the audio system.

This setting variable is used within the Engine module, specifically in the audio debugging subsystem. It’s referenced in the AudioDebug.cpp file, which is part of the Engine’s runtime.

The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 32 and can be changed at runtime through the console or configuration files.

The au.Debug.Sounds.Max variable interacts directly with the AudioDebugSoundMaxNumDisplayedCVar. They share the same value, with AudioDebugSoundMaxNumDisplayedCVar being the actual C++ variable used in the code, while au.Debug.Sounds.Max is the console-accessible name.

Developers should be aware that this variable affects the performance and readability of the audio debugging output. Setting it too high might impact performance or make the debug view cluttered, while setting it too low might hide important information.

Best practices when using this variable include:

  1. Adjusting it based on the complexity of your audio system and debugging needs.
  2. Using it in conjunction with other audio debugging tools for a comprehensive view of the audio state.
  3. Being mindful of performance implications when setting it to a high value, especially in performance-critical scenarios.

Regarding the associated variable AudioDebugSoundMaxNumDisplayedCVar:

The purpose of AudioDebugSoundMaxNumDisplayedCVar is to store the actual value used by the engine to limit the number of sounds displayed in the debugger. It’s an internal representation of the au.Debug.Sounds.Max setting.

This variable is used directly in the FAudioDebugger::RenderStatSounds function to control the loop that renders debug information for each sound. It’s also used to display the current maximum number of sounds being shown in the debug output.

The value of AudioDebugSoundMaxNumDisplayedCVar is set through the CVar system, specifically by the au.Debug.Sounds.Max console variable.

Developers should be aware that modifying AudioDebugSoundMaxNumDisplayedCVar directly in C++ code is not recommended. Instead, they should use the au.Debug.Sounds.Max console variable to ensure consistency across the engine.

Best practices for AudioDebugSoundMaxNumDisplayedCVar include:

  1. Treat it as a read-only variable in C++ code.
  2. Use it for conditionals in debugging code to respect the user-set limit.
  3. Consider its value when implementing new audio debugging features to ensure consistency with existing debug views.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:70

Scope: file

Source code excerpt:

static int32 AudioDebugSoundMaxNumDisplayedCVar = 32;
FAutoConsoleVariableRef CVarAudioDebugSoundMaxNumDisplayed(
	TEXT("au.Debug.Sounds.Max"),
	AudioDebugSoundMaxNumDisplayedCVar,
	TEXT("Max number of sounds to display in full sound debugger view. \n")
	TEXT("Default: 32"),
	ECVF_Default);

static int32 AudioDebugSoundShowPathCVar = 1;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:68

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 AudioDebugSoundMaxNumDisplayedCVar = 32;
FAutoConsoleVariableRef CVarAudioDebugSoundMaxNumDisplayed(
	TEXT("au.Debug.Sounds.Max"),
	AudioDebugSoundMaxNumDisplayedCVar,
	TEXT("Max number of sounds to display in full sound debugger view. \n")
	TEXT("Default: 32"),
	ECVF_Default);

static int32 AudioDebugSoundShowPathCVar = 1;
FAutoConsoleVariableRef CVarAudioDebugSoundShowPath(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:1880

Scope (from outer to inner):

file
namespace    Audio
function     int32 FAudioDebugger::RenderStatSounds

Source code excerpt:

			TotalSoundWavesNum += WaveInstancesNum;

			if (SoundIndex >= AudioDebugSoundMaxNumDisplayedCVar)
			{
				continue;
			}

			bool bDisplayWaves = false;
			const FString DisplayName = AudioDebugSoundShowPathCVar ? StatSoundInfo.SoundPath : StatSoundInfo.SoundName;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:1954

Scope (from outer to inner):

file
namespace    Audio
function     int32 FAudioDebugger::RenderStatSounds

Source code excerpt:

		}

		Canvas->DrawShadowedString(X, Y, *FString::Printf(TEXT("Audio Device ID: %u, Max Sounds Displayed: %i"), AudioDevice->DeviceID, AudioDebugSoundMaxNumDisplayedCVar), GetStatsFont(), HeaderColor);
		Y += FontHeight;

		Canvas->DrawShadowedString(X, Y, *FString::Printf(TEXT("Total Sounds: %i, Sound Waves: %i"), AudioStats.StatSoundInfos.Num(), TotalSoundWavesNum), GetStatsFont(), HeaderColor);
		Y += FontHeight;

		for (int32 i = 0; i < AudioStats.ListenerTransforms.Num(); ++i)