au.streamcaching.DebugView
au.streamcaching.DebugView
#Overview
name: au.streamcaching.DebugView
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables the comparison of FObjectKeys when comparing Stream Cache Chunk Keys. Without this FName collisions could occur if 2 SoundWaves have the same name.\n0: Legacy, 1: Default, 2: Averaged View, 3: High Detail View
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.streamcaching.DebugView is to control the debug view mode for the audio streaming cache system in Unreal Engine 5. It allows developers to visualize and debug the stream cache chunk keys and compare FObjectKeys to prevent potential FName collisions between SoundWaves with the same name.
This setting variable is primarily used in the audio streaming subsystem of Unreal Engine, specifically within the Engine module. It’s referenced in the AudioStreamingCache.cpp file, which is part of the audio streaming implementation.
The value of this variable is set using an FAutoConsoleVariableRef, which creates a console variable that can be modified at runtime. The default value is set to 2, which corresponds to the “Averaged View” mode.
The associated variable DebugViewCVar directly interacts with au.streamcaching.DebugView. They share the same value, and DebugViewCVar is used in the code to determine which debug display mode to use.
Developers should be aware that this variable offers four different debug view modes: 0: Legacy 1: Default 2: Averaged View (default setting) 3: High Detail View
When using this variable, developers should consider the following best practices:
- Use the debug view modes during development and testing to catch potential issues with audio streaming caching.
- Be cautious when using the Legacy mode (0), as it might not provide the most up-to-date debugging information.
- The Averaged View (2) and High Detail View (3) modes likely provide more comprehensive debugging information and should be preferred for in-depth analysis.
- Remember that enabling debug views may impact performance, so it’s best to use them only when necessary and disable them for production builds.
Regarding the associated variable DebugViewCVar:
The purpose of DebugViewCVar is to serve as an internal representation of the au.streamcaching.DebugView console variable within the C++ code. It allows for easy access to the current debug view mode setting without having to query the console variable system directly.
DebugViewCVar is used within the FAudioChunkCache::DebugDisplay function to determine which debug display mode to render. This indicates that it’s primarily used in the audio streaming cache’s debugging and visualization system.
The value of DebugViewCVar is set automatically by the FAutoConsoleVariableRef mechanism, which links it to the au.streamcaching.DebugView console variable.
Developers should be aware that modifying DebugViewCVar directly in code won’t affect the console variable setting. Always use the console variable au.streamcaching.DebugView to change the debug view mode.
Best practices for using DebugViewCVar include:
- Treat it as a read-only variable in most cases, as its value is controlled by the console variable system.
- Use it for conditional logic in debug-related code, such as selecting which debug display function to call.
- If you need to extend the debug view system, consider adding new cases to the existing switch-like structure in the DebugDisplay function rather than creating separate systems.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:120
Scope: file
Source code excerpt:
static int32 DebugViewCVar = 2;
FAutoConsoleVariableRef CVarDebugView(
TEXT("au.streamcaching.DebugView"),
DebugViewCVar,
TEXT("Enables the comparison of FObjectKeys when comparing Stream Cache Chunk Keys. Without this FName collisions could occur if 2 SoundWaves have the same name.\n")
TEXT("0: Legacy, 1: Default, 2: Averaged View, 3: High Detail View"),
ECVF_Default);
static int32 SearchUsingChunkArrayCVar = 1;
#Associated Variable and Callsites
This variable is associated with another variable named DebugViewCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:118
Scope: file
Source code excerpt:
ECVF_Default);
static int32 DebugViewCVar = 2;
FAutoConsoleVariableRef CVarDebugView(
TEXT("au.streamcaching.DebugView"),
DebugViewCVar,
TEXT("Enables the comparison of FObjectKeys when comparing Stream Cache Chunk Keys. Without this FName collisions could occur if 2 SoundWaves have the same name.\n")
TEXT("0: Legacy, 1: Default, 2: Averaged View, 3: High Detail View"),
ECVF_Default);
static int32 SearchUsingChunkArrayCVar = 1;
FAutoConsoleVariableRef CVarSearchUsingChunkArray(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:2759
Scope (from outer to inner):
file
function TPair<int, int> FAudioChunkCache::DebugDisplay
Source code excerpt:
// Draw the body of our display depending on the CVAR
TPair<int, int> Size(X, Y);
if (DebugViewCVar == 0)
{
Size = DebugDisplayLegacy(World, Viewport, Canvas, X, Y + 2 * BarPad, ViewLocation, ViewRotation);
}
else if (DebugViewCVar == 1)
{
// do nothing else (default)
}
else if (DebugViewCVar == 2)
{
DebugBirdsEyeDisplay(World, Viewport, Canvas, X, Y, ViewLocation, ViewRotation);
}
else if (DebugViewCVar == 3)
{
Size = DebugVisualDisplay(World, Viewport, Canvas, X, Y, ViewLocation, ViewRotation);
}
return Size;
}