au.streamcache.priming.PrimeDelayNodes
au.streamcache.priming.PrimeDelayNodes
#Overview
name: au.streamcache.priming.PrimeDelayNodes
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When set to 1, sounds will be loaded into the cache automatically when a delay node is hit.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.streamcache.priming.PrimeDelayNodes is to control whether sounds should be automatically loaded into the cache when a delay node is encountered in the audio system. This setting is primarily used in Unreal Engine’s audio subsystem, specifically for handling delayed sound nodes.
This setting variable is utilized in the Engine module, particularly in the SoundNodeDelay functionality. It’s part of the audio streaming and caching system, which is crucial for efficient audio playback in games.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized to 0 by default but can be changed at runtime using console commands or through configuration files.
The associated variable PrimeDelayedSoundNodesCVar directly interacts with au.streamcache.priming.PrimeDelayNodes. They share the same value, with PrimeDelayedSoundNodesCVar being the actual integer variable used in the code logic.
Developers should be aware that enabling this setting (setting it to 1) will cause sounds to be pre-loaded into the cache when a delay node is encountered. This can impact memory usage and potentially affect loading times, but it may improve audio playback responsiveness.
Best practices when using this variable include:
- Consider the trade-off between memory usage and audio responsiveness when enabling this feature.
- Test the impact of enabling this setting on your game’s performance, especially on target platforms with limited memory.
- Use this setting in conjunction with other audio streaming and caching settings for optimal performance.
- Monitor memory usage when this setting is enabled, especially for games with many delayed sound nodes.
Regarding the associated variable PrimeDelayedSoundNodesCVar:
This is an integer variable that directly represents the state of the au.streamcache.priming.PrimeDelayNodes setting. It’s used in the actual code logic to determine whether to prime (pre-load) child wave players when a delay node is encountered.
The variable is checked in the USoundNodeDelay::ParseNodes function. When PrimeDelayedSoundNodesCVar is non-zero, it triggers the PrimeChildWavePlayers function, which presumably loads the upcoming audio data into the cache.
Developers should note that this variable is static and file-scoped, meaning its value persists across function calls but is only accessible within the SoundNodeDelay.cpp file. Any changes to the console variable will be reflected in this variable, affecting the behavior of delayed sound nodes throughout the game.
When working with delayed sound nodes, developers should consider the implications of this setting on their audio design and ensure that it aligns with their intended audio behavior and performance requirements.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundNodeDelay.cpp:8
Scope: file
Source code excerpt:
static int32 PrimeDelayedSoundNodesCVar = 0;
FAutoConsoleVariableRef CVarPrimeDelayedSoundNodes(
TEXT("au.streamcache.priming.PrimeDelayNodes"),
PrimeDelayedSoundNodesCVar,
TEXT("When set to 1, sounds will be loaded into the cache automatically when a delay node is hit.\n"),
ECVF_Default);
struct FSoundNodeDelayPayload
{
#Associated Variable and Callsites
This variable is associated with another variable named PrimeDelayedSoundNodesCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundNodeDelay.cpp:6
Scope: file
Source code excerpt:
#include UE_INLINE_GENERATED_CPP_BY_NAME(SoundNodeDelay)
static int32 PrimeDelayedSoundNodesCVar = 0;
FAutoConsoleVariableRef CVarPrimeDelayedSoundNodes(
TEXT("au.streamcache.priming.PrimeDelayNodes"),
PrimeDelayedSoundNodesCVar,
TEXT("When set to 1, sounds will be loaded into the cache automatically when a delay node is hit.\n"),
ECVF_Default);
struct FSoundNodeDelayPayload
{
float EndOfDelay;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundNodeDelay.cpp:42
Scope (from outer to inner):
file
function void USoundNodeDelay::ParseNodes
Source code excerpt:
const float ActualDelay = FMath::Max(0.f, DelayMax + ( ( DelayMin - DelayMax ) * RandomStream.FRand() ));
if (PrimeDelayedSoundNodesCVar != 0)
{
PrimeChildWavePlayers(true);
}
if (ActualDelay > 0.0f && ParseParams.StartTime >= ActualDelay)
{