au.VirtualLoops.UpdateRate.Min
au.VirtualLoops.UpdateRate.Min
#Overview
name: au.VirtualLoops.UpdateRate.Min
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets minimum rate to check if sound becomes audible again at sound\'s max audible distance.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.VirtualLoops.UpdateRate.Min is to set the minimum rate at which the audio engine checks if a virtualized sound loop becomes audible again at its maximum audible distance. This setting is part of Unreal Engine’s audio system, specifically the virtual loop functionality.
This setting variable is primarily used in the Engine’s audio subsystem, particularly in the AudioVirtualLoop module. It’s referenced in the AudioVirtualLoop.cpp file, which suggests it’s an integral part of the virtual audio loop implementation.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0.1f and can be modified at runtime using console commands or through configuration files.
This variable interacts closely with another variable called VirtualLoopsUpdateRateMaxCVar. Together, these two variables define the range for the update rate of virtual audio loops. The actual update interval is calculated by interpolating between these min and max values based on the distance ratio of the listener to the sound source.
Developers should be aware that this variable affects performance and audio quality. A lower value will result in more frequent checks, potentially improving responsiveness but at the cost of increased CPU usage. Conversely, a higher value will reduce CPU usage but might introduce a slight delay in re-activating virtualized sounds.
Best practices when using this variable include:
- Balancing it with au.VirtualLoops.UpdateRate.Max for optimal performance and audio quality.
- Adjusting it based on the specific needs of the game or application, considering factors like the number of audio sources and the desired responsiveness.
- Profiling the audio performance to find the right balance between CPU usage and audio quality.
Regarding the associated variable VirtualLoopsUpdateRateMinCVar:
This is the actual float variable that stores the value set by au.VirtualLoops.UpdateRate.Min. It’s used internally by the engine to perform calculations related to virtual audio loops. The purpose of this variable is to provide a convenient way for the engine to access the minimum update rate value in C++ code.
VirtualLoopsUpdateRateMinCVar is set directly by the console variable system and is used in the CalculateUpdateInterval function of the FAudioVirtualLoop class. This function calculates the update interval for a virtual audio loop based on the distance between the listener and the sound source.
Developers should be aware that modifying VirtualLoopsUpdateRateMinCVar directly in code is not recommended. Instead, they should use the au.VirtualLoops.UpdateRate.Min console variable to change its value, ensuring that all parts of the engine are using the same, consistent value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioVirtualLoop.cpp:29
Scope: file
Source code excerpt:
static float VirtualLoopsUpdateRateMinCVar = 0.1f;
FAutoConsoleVariableRef CVarVirtualLoopsUpdateRateMin(
TEXT("au.VirtualLoops.UpdateRate.Min"),
VirtualLoopsUpdateRateMinCVar,
TEXT("Sets minimum rate to check if sound becomes audible again at sound's max audible distance.\n"),
ECVF_Default);
static float VirtualLoopsUpdateRateMaxCVar = 3.0f;
FAutoConsoleVariableRef CVarVirtualLoopsUpdateRateMax(
#Associated Variable and Callsites
This variable is associated with another variable named VirtualLoopsUpdateRateMinCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioVirtualLoop.cpp:27
Scope: file
Source code excerpt:
ECVF_Default);
static float VirtualLoopsUpdateRateMinCVar = 0.1f;
FAutoConsoleVariableRef CVarVirtualLoopsUpdateRateMin(
TEXT("au.VirtualLoops.UpdateRate.Min"),
VirtualLoopsUpdateRateMinCVar,
TEXT("Sets minimum rate to check if sound becomes audible again at sound's max audible distance.\n"),
ECVF_Default);
static float VirtualLoopsUpdateRateMaxCVar = 3.0f;
FAutoConsoleVariableRef CVarVirtualLoopsUpdateRateMax(
TEXT("au.VirtualLoops.UpdateRate.Max"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioVirtualLoop.cpp:157
Scope (from outer to inner):
file
function void FAudioVirtualLoop::CalculateUpdateInterval
Source code excerpt:
const float DistanceRatio = (DistanceToListener - ActiveSound->MaxDistance) / FMath::Max(VirtualLoopsPerfDistanceCVar, 1.0f);
const float DistanceRatioClamped = FMath::Clamp(DistanceRatio, 0.0f, 1.0f);
UpdateInterval = FMath::Lerp(VirtualLoopsUpdateRateMinCVar, VirtualLoopsUpdateRateMaxCVar, DistanceRatioClamped);
}
float FAudioVirtualLoop::GetTimeVirtualized() const
{
return TimeVirtualized;
}