au.DSP.InitialFDelayAllocationSeconds
au.DSP.InitialFDelayAllocationSeconds
#Overview
name: au.DSP.InitialFDelayAllocationSeconds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override the inital delay line allocation in seconds, it will grow up to InBufferLengthSec.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.DSP.InitialFDelayAllocationSeconds
is to control the initial allocation size of the delay line buffer in the audio processing system of Unreal Engine 5. This setting variable is primarily used in the digital signal processing (DSP) subsystem, specifically for managing audio delay effects.
This setting variable is utilized by the SignalProcessing module of Unreal Engine 5, as evidenced by its usage in the Delay.cpp
file within the SignalProcessing private directory.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of -1.0f and can be modified at runtime using console commands.
The associated variable FDelayInitialAllocationSecondsCVar
directly interacts with au.DSP.InitialFDelayAllocationSeconds
. They share the same value, with FDelayInitialAllocationSecondsCVar
being the C++ variable that stores the console variable’s value.
Developers must be aware that:
- A value less than or equal to 0 will result in the full
InBufferLengthSec
being allocated. - A positive value will override the initial delay line allocation, but it will still be capped at
InBufferLengthSec
. - The actual buffer size in samples is calculated based on this value and the sample rate.
Best practices when using this variable include:
- Use it to optimize memory usage by initially allocating a smaller buffer that can grow as needed.
- Be cautious when setting very small values, as it might lead to frequent buffer resizing and potential performance issues.
- Monitor performance and adjust the value based on the specific needs of your audio system.
Regarding the associated variable FDelayInitialAllocationSecondsCVar
:
The purpose of FDelayInitialAllocationSecondsCVar
is to provide a C++ accessible storage for the console variable au.DSP.InitialFDelayAllocationSeconds
. It serves as the bridge between the console variable system and the C++ code that implements the delay line functionality.
This variable is used within the Audio namespace in the SignalProcessing module. It’s primarily utilized in the FDelay::Init
function to determine the initial buffer size for the delay line.
The value of FDelayInitialAllocationSecondsCVar
is set automatically by the console variable system when au.DSP.InitialFDelayAllocationSeconds
is modified.
FDelayInitialAllocationSecondsCVar
directly interacts with the au.DSP.InitialFDelayAllocationSeconds
console variable and is used to calculate the InitialBufferSizeSeconds
in the FDelay::Init
function.
Developers should be aware that:
- This variable is static and has file scope, meaning it’s shared across all instances of
FDelay
. - Changes to this variable will affect all delay lines initialized after the change.
Best practices for using FDelayInitialAllocationSecondsCVar
include:
- Avoid modifying this variable directly; instead, use the console variable system to change
au.DSP.InitialFDelayAllocationSeconds
. - When implementing new audio delay features, refer to this variable to ensure consistent behavior with the engine’s delay line initialization.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/SignalProcessing/Private/Delay.cpp:6
Scope: file
Source code excerpt:
static float FDelayInitialAllocationSecondsCVar = -1.0f;
FAutoConsoleVariableRef CVarFDelayInitialAllocationSeconds(
TEXT("au.DSP.InitialFDelayAllocationSeconds"),
FDelayInitialAllocationSecondsCVar,
TEXT("Override the inital delay line allocation in seconds, it will grow up to InBufferLengthSec.\n"),
//TEXT("The default is -1. A value less than zero will allocate the full InBufferLengthSec\n"),
ECVF_Default);
namespace Audio
#Associated Variable and Callsites
This variable is associated with another variable named FDelayInitialAllocationSecondsCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/SignalProcessing/Private/Delay.cpp:4
Scope: file
Source code excerpt:
#include "HAL/IConsoleManager.h"
static float FDelayInitialAllocationSecondsCVar = -1.0f;
FAutoConsoleVariableRef CVarFDelayInitialAllocationSeconds(
TEXT("au.DSP.InitialFDelayAllocationSeconds"),
FDelayInitialAllocationSecondsCVar,
TEXT("Override the inital delay line allocation in seconds, it will grow up to InBufferLengthSec.\n"),
//TEXT("The default is -1. A value less than zero will allocate the full InBufferLengthSec\n"),
ECVF_Default);
namespace Audio
{
#Loc: <Workspace>/Engine/Source/Runtime/SignalProcessing/Private/Delay.cpp:37
Scope (from outer to inner):
file
namespace Audio
function void FDelay::Init
Source code excerpt:
float InitialBufferSizeSeconds = InBufferLengthSec;
if (FDelayInitialAllocationSecondsCVar > 0.f)
{
InitialBufferSizeSeconds = FMath::Min(InBufferLengthSec, FDelayInitialAllocationSecondsCVar);
}
AudioBufferSize = (int32)(InitialBufferSizeSeconds * (float)InSampleRate) + 1;
Reset();
}