au.WaveInstanceMinVolume
au.WaveInstanceMinVolume
#Overview
name: au.WaveInstanceMinVolume
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets the minimum volume for a wave instance to be considered active\nDefault is 0.0001 (-80 dB)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.WaveInstanceMinVolume is to set the minimum volume threshold for a wave instance to be considered active in the Unreal Engine audio system. This setting is crucial for optimizing audio performance and managing the active sound pool.
This setting variable is primarily used by the Unreal Engine’s audio system, specifically within the Engine module. Based on the callsites, it’s clear that this variable is utilized in the core audio processing logic.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s initialized with a default value of UE_KINDA_SMALL_NUMBER (approximately 0.0001 or -80 dB).
The associated variable WaveInstanceMinVolumeThresholdCVar directly interacts with au.WaveInstanceMinVolume. They share the same value, with WaveInstanceMinVolumeThresholdCVar being the actual variable used in the code logic.
Developers must be aware that this variable affects the performance and behavior of the audio system. Setting it too low might result in unnecessary processing of very quiet sounds, while setting it too high could cause audible sounds to be culled prematurely.
Best practices when using this variable include:
- Carefully consider the implications on performance and audio quality when adjusting this value.
- Use it in conjunction with other audio optimization techniques.
- Test thoroughly across different scenarios to ensure desired audio behavior.
Regarding the associated variable WaveInstanceMinVolumeThresholdCVar:
The purpose of WaveInstanceMinVolumeThresholdCVar is to serve as the actual variable used in the code to store and access the minimum volume threshold value set by au.WaveInstanceMinVolume.
This variable is used directly in the audio processing logic, specifically in the FWaveInstance::IsPlaying function. It determines whether a wave instance should be considered as playing based on its calculated volume.
The value of WaveInstanceMinVolumeThresholdCVar is set through the console variable system, mirroring the value of au.WaveInstanceMinVolume.
Developers should be aware that modifying WaveInstanceMinVolumeThresholdCVar directly in code is not recommended, as it’s designed to be configured through the console variable system.
Best practices for WaveInstanceMinVolumeThresholdCVar include:
- Avoid direct manipulation in code; instead, use the console variable system to modify its value.
- Consider its impact on audio performance when optimizing your game’s sound system.
- Use it as a reference point when implementing custom audio culling or optimization systems.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Audio.cpp:96
Scope: file
Source code excerpt:
static float WaveInstanceMinVolumeThresholdCVar = UE_KINDA_SMALL_NUMBER;
FAutoConsoleVariableRef CVarMinVolumeThreshold(
TEXT("au.WaveInstanceMinVolume"),
WaveInstanceMinVolumeThresholdCVar,
TEXT("Sets the minimum volume for a wave instance to be considered active\n")
TEXT("Default is 0.0001 (-80 dB)"),
ECVF_Default);
bool IsAudioPluginEnabled(EAudioPlugin PluginType)
#Associated Variable and Callsites
This variable is associated with another variable named WaveInstanceMinVolumeThresholdCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Audio.cpp:94
Scope: file
Source code excerpt:
ECVF_Default);
static float WaveInstanceMinVolumeThresholdCVar = UE_KINDA_SMALL_NUMBER;
FAutoConsoleVariableRef CVarMinVolumeThreshold(
TEXT("au.WaveInstanceMinVolume"),
WaveInstanceMinVolumeThresholdCVar,
TEXT("Sets the minimum volume for a wave instance to be considered active\n")
TEXT("Default is 0.0001 (-80 dB)"),
ECVF_Default);
bool IsAudioPluginEnabled(EAudioPlugin PluginType)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Audio.cpp:930
Scope (from outer to inner):
file
function bool FWaveInstance::IsPlaying
Source code excerpt:
const float WaveInstanceVolume = Volume * VolumeMultiplier * GetDistanceAndOcclusionAttenuation() * GetDynamicVolume();
if (WaveInstanceVolume > WaveInstanceMinVolumeThresholdCVar)
{
return true;
}
if (ActiveSound->ComponentVolumeFader.IsFadingIn())
{