au.Debug.Generator.Amp
au.Debug.Generator.Amp
#Overview
name: au.Debug.Generator.Amp
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets.\nDefault: 0.2f
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.Debug.Generator.Amp is to set the amplitude for a debug audio generator in the Unreal Engine’s audio mixer system. This setting variable is used for debugging and testing purposes within the audio subsystem.
The Unreal Engine subsystem that relies on this setting variable is the Audio Mixer module, specifically within the AudioMixerDevice component. This can be seen from the file path where the variable is referenced: Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp.
The value of this variable is set through the Unreal Engine’s console variable system. It is defined as an FAutoConsoleVariableRef with a default value of 0.2f. This means it can be adjusted at runtime through console commands or configuration files.
The associated variable that interacts with au.Debug.Generator.Amp is DebugGeneratorAmpCVar. They share the same value, with DebugGeneratorAmpCVar being the actual float variable used in the code, while au.Debug.Generator.Amp is the console variable name used to access and modify it.
Developers must be aware that this variable is specifically for debugging purposes and should not be relied upon for production audio generation. It’s used in test functions like WhiteNoiseTest and SineOscTest to generate debug audio signals.
Best practices when using this variable include:
- Only use it for debugging and testing purposes.
- Be cautious when modifying its value, as it directly affects the amplitude of the debug audio signal.
- Remember to reset it to its default value (0.2f) after testing to avoid unintended effects.
- Use it in conjunction with other debug audio variables like DebugGeneratorFreqCVar and DebugGeneratorEnableCVar for comprehensive audio debugging.
Regarding the associated variable DebugGeneratorAmpCVar:
The purpose of DebugGeneratorAmpCVar is to store the actual float value of the amplitude used in the debug audio generator. It’s the internal representation of the au.Debug.Generator.Amp console variable.
This variable is used directly in the AudioMixer module, specifically in the FMixerDevice class methods like WhiteNoiseTest and SineOscTest.
The value of DebugGeneratorAmpCVar is set initially to 0.2f and can be modified through the au.Debug.Generator.Amp console variable.
DebugGeneratorAmpCVar interacts closely with other debug generator variables like DebugGeneratorFreqCVar and DebugGeneratorEnableCVar to control various aspects of the debug audio generation.
Developers should be aware that modifying DebugGeneratorAmpCVar directly in the code is not recommended. Instead, they should use the console variable au.Debug.Generator.Amp to ensure consistency and proper integration with the engine’s variable system.
Best practices for DebugGeneratorAmpCVar include:
- Treat it as read-only in code; modify it through the console variable system.
- Use it consistently within the debug audio generation functions.
- Be aware of its current value when interpreting debug audio output.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:85
Scope: file
Source code excerpt:
static float DebugGeneratorAmpCVar = 0.2f;
FAutoConsoleVariableRef CVarDebugGeneratorAmp(
TEXT("au.Debug.Generator.Amp"),
DebugGeneratorAmpCVar,
TEXT("Sets.\n")
TEXT("Default: 0.2f"),
ECVF_Default);
static int32 DebugGeneratorChannelCVar = 0;
#Associated Variable and Callsites
This variable is associated with another variable named DebugGeneratorAmpCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:83
Scope: file
Source code excerpt:
ECVF_Default);
static float DebugGeneratorAmpCVar = 0.2f;
FAutoConsoleVariableRef CVarDebugGeneratorAmp(
TEXT("au.Debug.Generator.Amp"),
DebugGeneratorAmpCVar,
TEXT("Sets.\n")
TEXT("Default: 0.2f"),
ECVF_Default);
static int32 DebugGeneratorChannelCVar = 0;
FAutoConsoleVariableRef CVarDebugGeneratorChannel(
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:2855
Scope (from outer to inner):
file
namespace Audio
function void FMixerDevice::WhiteNoiseTest
Source code excerpt:
{
int32 Index = FrameIndex * NumChannels + ChannelIndex;
Output[Index] += WhiteNoise.Generate(DebugGeneratorAmpCVar, 0.f);
}
}
}
void FMixerDevice::SineOscTest(FAlignedFloatBuffer& Output)
{
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:2870
Scope (from outer to inner):
file
namespace Audio
function void FMixerDevice::SineOscTest
Source code excerpt:
const int32 ChannelIndex = FMath::Clamp(DebugGeneratorChannelCVar, 0, NumChannels - 1);
static FSineOsc SineOscLeft(PlatformInfo.SampleRate, DebugGeneratorFreqCVar, DebugGeneratorAmpCVar);
static FSineOsc SineOscRight(PlatformInfo.SampleRate, DebugGeneratorFreqCVar / 2.0f, DebugGeneratorAmpCVar);
SineOscLeft.SetFrequency(DebugGeneratorFreqCVar);
SineOscLeft.SetScale(DebugGeneratorAmpCVar);
if (!DebugGeneratorEnableCVar)
{
SineOscRight.SetFrequency(DebugGeneratorFreqCVar / 2.0f);
SineOscRight.SetScale(DebugGeneratorAmpCVar);
}
for (int32 FrameIndex = 0; FrameIndex < NumFrames; ++FrameIndex)
{
int32 Index = FrameIndex * NumChannels;