au.Debug.Generator.Channel
au.Debug.Generator.Channel
#Overview
name: au.Debug.Generator.Channel
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets channel output index of debug audio. If number provided is above supported number, uses left.\n0: Left, 1: Right, etc.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.Debug.Generator.Channel is to set the channel output index for debug audio in the Unreal Engine’s audio mixer system. It is used to control which audio channel (left, right, or other) will output the debug audio signal.
This setting variable is primarily used by the Audio Mixer subsystem within Unreal Engine 5. It is referenced in the AudioMixer module, specifically in the AudioMixerDevice.cpp file.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 0 and can be changed at runtime using console commands or through code.
The au.Debug.Generator.Channel variable interacts closely with DebugGeneratorChannelCVar. They share the same value, with DebugGeneratorChannelCVar serving as the actual storage for the setting.
Developers must be aware that:
- The channel index is zero-based (0 for left, 1 for right, etc.).
- If the provided channel index is higher than the supported number of channels, the system defaults to the left channel.
- This setting is primarily for debugging purposes and should not be relied upon for production audio output.
Best practices when using this variable include:
- Use it only for debugging and testing purposes.
- Be aware of the number of audio channels in your project to avoid unexpected behavior.
- Reset it to the default value (0) after debugging to ensure normal audio output.
Regarding the associated variable DebugGeneratorChannelCVar:
The purpose of DebugGeneratorChannelCVar is to store the actual value of the debug generator channel setting. It is an internal variable that directly corresponds to the au.Debug.Generator.Channel console variable.
This variable is used within the Audio Mixer subsystem, specifically in the FMixerDevice class’s SineOscTest function. It determines which channel the debug sine wave generator outputs to.
The value of DebugGeneratorChannelCVar is set through the console variable system and is directly tied to au.Debug.Generator.Channel.
DebugGeneratorChannelCVar interacts with other debug-related variables such as DebugGeneratorFreqCVar and DebugGeneratorAmpCVar, which control the frequency and amplitude of the debug sine wave, respectively.
Developers should be aware that:
- The value is clamped to ensure it’s within the range of available channels.
- It’s used in conjunction with other debug generator settings to produce test audio output.
Best practices for using DebugGeneratorChannelCVar include:
- Access it through the au.Debug.Generator.Channel console variable rather than directly.
- Use it in conjunction with other debug audio settings for comprehensive audio testing.
- Remember to disable or reset debug audio settings after testing to avoid interference with normal audio playback.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:93
Scope: file
Source code excerpt:
static int32 DebugGeneratorChannelCVar = 0;
FAutoConsoleVariableRef CVarDebugGeneratorChannel(
TEXT("au.Debug.Generator.Channel"),
DebugGeneratorChannelCVar,
TEXT("Sets channel output index of debug audio. If number provided is above supported number, uses left.\n")
TEXT("0: Left, 1: Right, etc."),
ECVF_Default);
static float DebugGeneratorFreqCVar = 440.0f;
#Associated Variable and Callsites
This variable is associated with another variable named DebugGeneratorChannelCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:91
Scope: file
Source code excerpt:
ECVF_Default);
static int32 DebugGeneratorChannelCVar = 0;
FAutoConsoleVariableRef CVarDebugGeneratorChannel(
TEXT("au.Debug.Generator.Channel"),
DebugGeneratorChannelCVar,
TEXT("Sets channel output index of debug audio. If number provided is above supported number, uses left.\n")
TEXT("0: Left, 1: Right, etc."),
ECVF_Default);
static float DebugGeneratorFreqCVar = 440.0f;
FAutoConsoleVariableRef CVarDebugGeneratorFreq(
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:2868
Scope (from outer to inner):
file
namespace Audio
function void FMixerDevice::SineOscTest
Source code excerpt:
// Constrain user setting if channel index not supported
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);
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:2891
Scope (from outer to inner):
file
namespace Audio
function void FMixerDevice::SineOscTest
Source code excerpt:
if (!DebugGeneratorEnableCVar)
{
if (NumChannels > 1 && DebugGeneratorChannelCVar == 0)
{
Output[Index + 1] += SineOscRight.ProcessAudio();
}
}
}
}