au.Debug.Generator
au.Debug.Generator
#Overview
name: au.Debug.Generator
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables/disables debug sound generation.\n0: Disabled, 1: SinTone, 2: WhiteNoise
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.Debug.Generator
is to enable and control debug sound generation in the Unreal Engine’s audio mixer system. This setting variable is used for testing and debugging purposes within the audio subsystem.
The Unreal Engine subsystem that relies on this setting variable is the AudioMixer module, specifically within the FMixerDevice
class, which is part of the audio rendering system.
The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 and can be changed at runtime using console commands.
This variable interacts with several other variables:
DebugGeneratorEnableCVar
: This is the associated C++ variable that directly maps to theau.Debug.Generator
console variable.DebugGeneratorAmpCVar
: Controls the amplitude of the debug sound.DebugGeneratorFreqCVar
: Controls the frequency of the debug sound (for sine wave generation).DebugGeneratorChannelCVar
: Determines which channel the debug sound is output to.
Developers must be aware of the following when using this variable:
- It has three possible values: 0 (Disabled), 1 (SinTone), and 2 (WhiteNoise).
- Enabling this variable will override normal audio output with debug sounds, which may interfere with regular audio playback.
- It’s primarily intended for debugging and testing purposes, not for production use.
Best practices when using this variable include:
- Only enable it when actively debugging audio issues.
- Remember to disable it after debugging to restore normal audio functionality.
- Use in conjunction with other debug variables (amp, freq, channel) for comprehensive audio testing.
- Be cautious when using in multiplayer or networked environments, as it may affect only the local instance.
Regarding the associated variable DebugGeneratorEnableCVar
:
The purpose of DebugGeneratorEnableCVar
is to serve as the C++ representation of the au.Debug.Generator
console variable. It’s an integer that directly maps to the console variable’s value.
This variable is used within the AudioMixer module, specifically in the FMixerDevice
class methods.
The value of this variable is set by the console variable system when au.Debug.Generator
is modified.
It interacts primarily with the au.Debug.Generator
console variable and is used in conditional statements to control the debug sound generation behavior.
Developers should be aware that modifying this variable directly in C++ code might lead to inconsistencies with the console variable system. It’s best to interact with it through the au.Debug.Generator
console variable.
Best practices for using DebugGeneratorEnableCVar
include:
- Treat it as read-only in most cases, letting the console variable system manage its value.
- Use it for conditional checks in audio processing code to enable or disable debug sound generation.
- Remember that changes to this variable will immediately affect audio output, so use with caution in performance-critical sections.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:77
Scope: file
Source code excerpt:
static int32 DebugGeneratorEnableCVar = 0;
FAutoConsoleVariableRef CVarDebugGeneratorEnable(
TEXT("au.Debug.Generator"),
DebugGeneratorEnableCVar,
TEXT("Enables/disables debug sound generation.\n")
TEXT("0: Disabled, 1: SinTone, 2: WhiteNoise"),
ECVF_Default);
static float DebugGeneratorAmpCVar = 0.2f;
#Associated Variable and Callsites
This variable is associated with another variable named DebugGeneratorEnableCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:75
Scope: file
Source code excerpt:
ECVF_Default);
static int32 DebugGeneratorEnableCVar = 0;
FAutoConsoleVariableRef CVarDebugGeneratorEnable(
TEXT("au.Debug.Generator"),
DebugGeneratorEnableCVar,
TEXT("Enables/disables debug sound generation.\n")
TEXT("0: Disabled, 1: SinTone, 2: WhiteNoise"),
ECVF_Default);
static float DebugGeneratorAmpCVar = 0.2f;
FAutoConsoleVariableRef CVarDebugGeneratorAmp(
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:966
Scope (from outer to inner):
file
namespace Audio
function bool FMixerDevice::OnProcessAudioStream
Source code excerpt:
// Do any debug output performing
if (bDebugOutputEnabled || DebugGeneratorEnableCVar > 0)
{
if (DebugGeneratorEnableCVar < 2)
{
SineOscTest(Output);
}
else
{
WhiteNoiseTest(Output);
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:2876
Scope (from outer to inner):
file
namespace Audio
function void FMixerDevice::SineOscTest
Source code excerpt:
SineOscLeft.SetScale(DebugGeneratorAmpCVar);
if (!DebugGeneratorEnableCVar)
{
SineOscRight.SetFrequency(DebugGeneratorFreqCVar / 2.0f);
SineOscRight.SetScale(DebugGeneratorAmpCVar);
}
for (int32 FrameIndex = 0; FrameIndex < NumFrames; ++FrameIndex)
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:2889
Scope (from outer to inner):
file
namespace Audio
function void FMixerDevice::SineOscTest
Source code excerpt:
// Using au. commands for debug only supports discrete channel
if (!DebugGeneratorEnableCVar)
{
if (NumChannels > 1 && DebugGeneratorChannelCVar == 0)
{
Output[Index + 1] += SineOscRight.ProcessAudio();
}
}