au.3dVisualize.SpatialSources

au.3dVisualize.SpatialSources

#Overview

name: au.3dVisualize.SpatialSources

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 au.3dVisualize.SpatialSources is to control the visibility of audio spatialized sources when 3D visualization is enabled in Unreal Engine 5. This setting variable is part of the audio debugging system.

This setting variable is primarily used by the Engine module, specifically within 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 1 (enabled) and can be changed at runtime through the console or configuration files.

The au.3dVisualize.SpatialSources variable interacts directly with the SpatialSourceVisualizeEnabledCVar variable. They share the same value, with SpatialSourceVisualizeEnabledCVar being the actual int32 variable used in the code logic.

Developers must be aware that this variable affects the visualization of spatialized audio sources. When set to 0, it will disable the visualization of these sources even if 3D visualization is enabled overall.

Best practices for using this variable include:

  1. Use it for debugging purposes, especially when working on spatial audio features.
  2. Be aware that enabling this visualization might have a performance impact, so it should be used judiciously in production builds.
  3. Consider exposing this setting in a debug menu for easier toggling during development and testing.

Regarding the associated variable SpatialSourceVisualizeEnabledCVar:

The purpose of SpatialSourceVisualizeEnabledCVar is to serve as the actual int32 variable that stores the state of the au.3dVisualize.SpatialSources setting.

This variable is used directly in the audio debugging code to determine whether to visualize spatialized audio sources. It’s checked in the FAudioDebugger::DrawDebugInfo function to control the execution of the visualization code.

The value of SpatialSourceVisualizeEnabledCVar is set through the console variable system, using the au.3dVisualize.SpatialSources command.

SpatialSourceVisualizeEnabledCVar interacts directly with the au.3dVisualize.SpatialSources console variable, serving as its backing storage.

Developers should be aware that modifying SpatialSourceVisualizeEnabledCVar directly in code will not update the console variable state. Always use the console variable system to modify this setting.

Best practices for SpatialSourceVisualizeEnabledCVar include:

  1. Avoid modifying it directly in code; instead, use the console variable system.
  2. When reading its value, consider caching it if used frequently to avoid repeated CVar lookups.
  3. Be aware of its impact on performance and visual clutter when enabled, especially in non-development builds.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

static int32 SpatialSourceVisualizeEnabledCVar = 1;
FAutoConsoleVariableRef CVarAudioVisualizeSpatialSourceEnabled(
	TEXT("au.3dVisualize.SpatialSources"),
	SpatialSourceVisualizeEnabledCVar,
	TEXT("Whether or not audio spatialized sources are visible when 3d visualize is enabled. \n")
	TEXT("0: Not Enabled, 1: Enabled"),
	ECVF_Default);

static int32 VirtualLoopsVisualizeEnabledCVar = 1;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 SpatialSourceVisualizeEnabledCVar = 1;
FAutoConsoleVariableRef CVarAudioVisualizeSpatialSourceEnabled(
	TEXT("au.3dVisualize.SpatialSources"),
	SpatialSourceVisualizeEnabledCVar,
	TEXT("Whether or not audio spatialized sources are visible when 3d visualize is enabled. \n")
	TEXT("0: Not Enabled, 1: Enabled"),
	ECVF_Default);

static int32 VirtualLoopsVisualizeEnabledCVar = 1;
FAutoConsoleVariableRef CVarAudioVisualizeVirtualLoopsEnabled(

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

Scope (from outer to inner):

file
namespace    Audio
function     void FAudioDebugger::DrawDebugInfo

Source code excerpt:

		}

		if (!SpatialSourceVisualizeEnabledCVar)
		{
			return;
		}

		FAudioDeviceManager* DeviceManager = GEngine->GetAudioDeviceManager();
		if (DeviceManager && DeviceManager->IsVisualizeDebug3dEnabled())