au.NumPrecacheFrames
au.NumPrecacheFrames
#Overview
name: au.NumPrecacheFrames
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When set to > 0, will use that value as the number of frames to precache audio buffers with.\n0: Use default value for precache frames, >0: Number of frames to precache.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.NumPrecacheFrames is to control the number of frames used to precache audio buffers in Unreal Engine’s audio system. This setting variable is part of the audio subsystem and affects how audio data is loaded and prepared for playback.
The Unreal Engine audio subsystem relies on this setting variable, specifically within the FAudioDevice class, which is a core component of the audio system.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0 and can be changed at runtime using console commands or through configuration files.
The associated variable NumPrecacheFramesCvar interacts directly with au.NumPrecacheFrames. They share the same value, with NumPrecacheFramesCvar serving as the actual storage for the setting.
Developers must be aware that:
- Setting this variable to a value greater than 0 will override the default precache frame count.
- A value of 0 means the system will use the default value for precache frames.
- This setting affects audio performance and memory usage, as it determines how much audio data is preloaded.
Best practices when using this variable include:
- Only modify this value if you understand the implications on audio performance and memory usage.
- Test thoroughly after changing this value to ensure it doesn’t negatively impact audio quality or game performance.
- Consider platform-specific requirements when setting this value, as different platforms may have varying audio processing capabilities.
Regarding the associated variable NumPrecacheFramesCvar:
- It’s the actual storage for the au.NumPrecacheFrames setting.
- It’s used in the GetNumPrecacheFrames function of FAudioDevice to determine the number of frames to precache.
- If NumPrecacheFramesCvar is greater than 0, it takes precedence over the default NumPrecacheFrames value.
- Developers should generally interact with au.NumPrecacheFrames rather than directly manipulating NumPrecacheFramesCvar, as the former provides a standardized interface through the console variable system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:119
Scope: file
Source code excerpt:
static int32 NumPrecacheFramesCvar = 0;
FAutoConsoleVariableRef CVarNumPrecacheFrames(
TEXT("au.NumPrecacheFrames"),
NumPrecacheFramesCvar,
TEXT("When set to > 0, will use that value as the number of frames to precache audio buffers with.\n")
TEXT("0: Use default value for precache frames, >0: Number of frames to precache."),
ECVF_Default);
static int32 DisableLegacyReverb = 0;
#Associated Variable and Callsites
This variable is associated with another variable named NumPrecacheFramesCvar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:117
Scope: file
Source code excerpt:
ECVF_Default);
static int32 NumPrecacheFramesCvar = 0;
FAutoConsoleVariableRef CVarNumPrecacheFrames(
TEXT("au.NumPrecacheFrames"),
NumPrecacheFramesCvar,
TEXT("When set to > 0, will use that value as the number of frames to precache audio buffers with.\n")
TEXT("0: Use default value for precache frames, >0: Number of frames to precache."),
ECVF_Default);
static int32 DisableLegacyReverb = 0;
FAutoConsoleVariableRef CVarDisableLegacyReverb(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:7382
Scope (from outer to inner):
file
function int32 FAudioDevice::GetNumPrecacheFrames
Source code excerpt:
{
// Check the cvar and use that if it's been set.
if (NumPrecacheFramesCvar > 0)
{
return NumPrecacheFramesCvar;
}
// Otherwise, use the default value or value set in ini file
return NumPrecacheFrames;
}
void FAudioDevice::UpdateUnpreparedSound(FWaveInstance* WaveInstance, bool bGameTicking) const