au.Debug.Generator.Freq
au.Debug.Generator.Freq
#Overview
name: au.Debug.Generator.Freq
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets debug sound generation frequency.\n0: Not Disabled, 1: SinTone, 2: WhiteNoise
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.Debug.Generator.Freq is to set the frequency for debug sound generation in the Unreal Engine’s audio mixer system. It is used for testing and debugging purposes within the audio subsystem.
This setting variable is primarily utilized by the Audio Mixer module of Unreal Engine. It is referenced in the AudioMixerDevice.cpp file, which is part of the core audio processing system.
The value of this variable is set through the Unreal Engine’s console variable system. It is initialized with a default value of 440.0f (which corresponds to the musical note A4) and can be modified at runtime through console commands or programmatically.
The au.Debug.Generator.Freq variable interacts closely with DebugGeneratorFreqCVar, which is the actual float variable that stores the frequency value. They share the same value, with au.Debug.Generator.Freq serving as the console-accessible name for the variable.
Developers should be aware that this variable is specifically for debugging purposes and should not be relied upon for production sound generation. It’s important to note that the variable’s description in the code suggests it can take values 0, 1, or 2, but it’s actually used as a floating-point frequency value in Hertz.
Best practices when using this variable include:
- Use it only for debugging and testing purposes.
- Be aware that changing this value will affect the frequency of the debug sound generator.
- Remember that this setting affects the entire audio mixer system and is not localized to specific sound instances.
Regarding the associated variable DebugGeneratorFreqCVar:
The purpose of DebugGeneratorFreqCVar is to store the actual float value of the debug generator frequency. It serves as the backing variable for the au.Debug.Generator.Freq console variable.
This variable is used directly in the audio mixer’s sine wave oscillator test function (SineOscTest). It determines the frequency of the generated sine wave for the left channel, while half its value is used for the right channel.
The value of DebugGeneratorFreqCVar is set through the console variable system, mirroring the value of au.Debug.Generator.Freq.
DebugGeneratorFreqCVar interacts with other debug-related variables such as DebugGeneratorAmpCVar (for amplitude) and DebugGeneratorChannelCVar (for channel selection).
Developers should be aware that modifying DebugGeneratorFreqCVar directly in code will not update the console variable. Always use the console variable system to ensure consistency.
Best practices for DebugGeneratorFreqCVar include:
- Avoid modifying it directly; instead, use the au.Debug.Generator.Freq console variable.
- When reading its value, be aware that it may change at runtime due to console commands.
- Use it in conjunction with other debug variables for comprehensive audio debugging.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:101
Scope: file
Source code excerpt:
static float DebugGeneratorFreqCVar = 440.0f;
FAutoConsoleVariableRef CVarDebugGeneratorFreq(
TEXT("au.Debug.Generator.Freq"),
DebugGeneratorFreqCVar,
TEXT("Sets debug sound generation frequency.\n")
TEXT("0: Not Disabled, 1: SinTone, 2: WhiteNoise"),
ECVF_Default);
static int32 AudioMixerPatchBufferBlocks = 3;
#Associated Variable and Callsites
This variable is associated with another variable named DebugGeneratorFreqCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:99
Scope: file
Source code excerpt:
ECVF_Default);
static float DebugGeneratorFreqCVar = 440.0f;
FAutoConsoleVariableRef CVarDebugGeneratorFreq(
TEXT("au.Debug.Generator.Freq"),
DebugGeneratorFreqCVar,
TEXT("Sets debug sound generation frequency.\n")
TEXT("0: Not Disabled, 1: SinTone, 2: WhiteNoise"),
ECVF_Default);
static int32 AudioMixerPatchBufferBlocks = 3;
FAutoConsoleVariableRef CVarAudioMixerPatchBufferBlocks(
#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;