au.3dVisualize.ActiveSounds
au.3dVisualize.ActiveSounds
#Overview
name: au.3dVisualize.ActiveSounds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Visualization mode for active sounds. \n0: Not Enabled, 1: Volume (Lin), 2: Volume (dB), 3: Distance, 4: Random color, 5: Occlusion
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.3dVisualize.ActiveSounds is to control the visualization mode for active sounds in Unreal Engine 5. This setting variable is primarily used for debugging and visualizing audio-related information in the engine.
-
The audio debugging system in Unreal Engine 5 relies on this setting variable. It’s part of the engine’s audio visualization and debugging tools.
-
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 and can be changed at runtime.
-
This variable interacts closely with ActiveSoundVisualizeModeCVar, which is the actual integer variable that stores the visualization mode value. au.3dVisualize.ActiveSounds is the console command that controls ActiveSoundVisualizeModeCVar.
-
Developers must be aware that this variable affects how active sounds are visualized in the engine. Different modes provide different types of visual feedback: 0: Visualization not enabled 1: Volume visualization (Linear scale) 2: Volume visualization (Decibel scale) 3: Distance visualization 4: Random color visualization 5: Occlusion visualization
-
Best practices when using this variable include:
- Use it primarily for debugging purposes.
- Be aware of performance implications when enabling visualization in a production environment.
- Choose the appropriate visualization mode based on the specific audio aspect you’re investigating.
Regarding the associated variable ActiveSoundVisualizeModeCVar:
- Its purpose is to store the actual integer value of the visualization mode.
- It’s used directly in the audio debugging system to determine which visualization mode to apply.
- The value is set through the au.3dVisualize.ActiveSounds console command.
- It interacts with various parts of the audio debugging system to control how active sounds are visualized.
- Developers should not modify this variable directly but instead use the au.3dVisualize.ActiveSounds console command to change its value.
- Best practices include using this variable in conjunction with other audio debugging tools and being mindful of its impact on performance when enabled.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:30
Scope: file
Source code excerpt:
static int32 ActiveSoundVisualizeModeCVar = 1;
FAutoConsoleVariableRef CVarAudioVisualizeActiveSoundsMode(
TEXT("au.3dVisualize.ActiveSounds"),
ActiveSoundVisualizeModeCVar,
TEXT("Visualization mode for active sounds. \n")
TEXT("0: Not Enabled, 1: Volume (Lin), 2: Volume (dB), 3: Distance, 4: Random color, 5: Occlusion"),
ECVF_Default);
static int32 ActiveSoundVisualizeListenersCVar = 0;
#Associated Variable and Callsites
This variable is associated with another variable named ActiveSoundVisualizeModeCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:28
Scope: file
Source code excerpt:
// Console variables
static int32 ActiveSoundVisualizeModeCVar = 1;
FAutoConsoleVariableRef CVarAudioVisualizeActiveSoundsMode(
TEXT("au.3dVisualize.ActiveSounds"),
ActiveSoundVisualizeModeCVar,
TEXT("Visualization mode for active sounds. \n")
TEXT("0: Not Enabled, 1: Volume (Lin), 2: Volume (dB), 3: Distance, 4: Random color, 5: Occlusion"),
ECVF_Default);
static int32 ActiveSoundVisualizeListenersCVar = 0;
FAutoConsoleVariableRef CVarAudioVisualizeListeners(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:1066
Scope (from outer to inner):
file
namespace Audio
function void FAudioDebugger::DrawDebugInfo
Source code excerpt:
{
#if ENABLE_DRAW_DEBUG
if (!ActiveSoundVisualizeModeCVar)
{
return;
}
// Only draw spatialized sounds
const USoundBase* Sound = ActiveSound.GetSound();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:1113
Scope (from outer to inner):
file
namespace Audio
function void FAudioDebugger::DrawDebugInfo
Source code excerpt:
float DisplayValue = 0.0f;
float FilterValue = 0.0f;
if (ActiveSoundVisualizeModeCVar == 1 || ActiveSoundVisualizeModeCVar == 2)
{
for (FWaveInstance* WaveInstance : ThisSoundsWaveInstances)
{
DisplayValue = FMath::Max(DisplayValue, WaveInstance->GetVolumeWithDistanceAndOcclusionAttenuation() * WaveInstance->GetDynamicVolume());
}
}
else if (ActiveSoundVisualizeModeCVar == 3)
{
if (ActiveSound.AudioDevice)
{
DisplayValue = ActiveSound.AudioDevice->GetDistanceToNearestListener(ActiveSound.Transform.GetLocation()) / CurMaxDistance;
}
}
else if (ActiveSoundVisualizeModeCVar == 4)
{
TextColor = ActiveSound.DebugColor;
}
else if (ActiveSoundVisualizeModeCVar == 5)
{
DisplayValue = ActiveSound.CurrentOcclusionVolumeAttenuation.GetValue();
FilterValue = ActiveSound.CurrentOcclusionFilterFrequency.GetValue();
}
TWeakObjectPtr<UWorld> WorldPtr = ActiveSound.GetWeakWorld();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:1151
Scope (from outer to inner):
file
namespace Audio
function void FAudioDebugger::DrawDebugInfo
lambda-function
Source code excerpt:
FString Descriptor;
if (ActiveSoundVisualizeModeCVar == 1 || ActiveSoundVisualizeModeCVar == 2)
{
const float DisplayDbVolume = Audio::ConvertToDecibels(DisplayValue);
if (ActiveSoundVisualizeModeCVar == 1)
{
Descriptor = FString::Printf(TEXT(" (Vol: %.3f [Active: %.2fs, Playing: %.2fs])"), DisplayValue, PlaybackTime, PlaybackTimeNonVirtualized);
}
else
{
Descriptor = FString::Printf(TEXT(" (Vol: %.3f dB [Active: %.2fs, Playing: %.2fs])"), DisplayDbVolume, PlaybackTime, PlaybackTimeNonVirtualized);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDebug.cpp:1167
Scope (from outer to inner):
file
namespace Audio
function void FAudioDebugger::DrawDebugInfo
lambda-function
Source code excerpt:
Color = FLinearColor::MakeFromHSV8(static_cast<uint8>(Hue), 255u, 255u).ToFColor(true);
}
else if (ActiveSoundVisualizeModeCVar == 3)
{
Descriptor = FString::Printf(TEXT(" (Dist: %.3f, Max: %.3f)"), DisplayValue * CurMaxDistance, CurMaxDistance);
const float Hue = FMath::Lerp(ColorGreenHue, ColorRedHue, DisplayValue);
Color = FLinearColor::MakeFromHSV8(static_cast<uint8>(FMath::Clamp(Hue, 0.0f, 255.f)), 255u, 255u).ToFColor(true);
}
else if (ActiveSoundVisualizeModeCVar == 5)
{
Descriptor = FString::Printf(TEXT(" (Occlusion Volume: %.3f, Occlusion Filter: %.3f)"), DisplayValue, FilterValue);
if (bOccluded)
{
Color = FColor::Red;
}