au.DecompressionThreshold
au.DecompressionThreshold
#Overview
name: au.DecompressionThreshold
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If non-zero, overrides the decompression threshold set in either the sound group or the platform\'s runtime settings.\nValue: Maximum duration we should fully decompress, in seconds.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.DecompressionThreshold is to control the maximum duration of audio that should be fully decompressed in the Unreal Engine audio system. This setting is part of the audio compression and decompression subsystem.
The Unreal Engine audio module relies on this setting variable, as evidenced by its use in the AudioDevice.cpp file within the Engine/Source/Runtime/Engine directory.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0.0f and can be modified at runtime using console commands or through code.
The au.DecompressionThreshold interacts with another variable named DecompressionThresholdCvar. They share the same value, with DecompressionThresholdCvar being the actual storage for the threshold value.
Developers must be aware that:
- This variable overrides the decompression threshold set in either the sound group or the platform’s runtime settings when it’s non-zero.
- The value represents the maximum duration (in seconds) of audio that should be fully decompressed.
- A value of 0.0f means the variable is not overriding any other settings.
Best practices when using this variable include:
- Use it judiciously, as fully decompressing audio can impact memory usage.
- Consider the target platform’s capabilities when setting this value.
- Monitor performance and memory usage when adjusting this value, especially for mobile or memory-constrained platforms.
Regarding the associated variable DecompressionThresholdCvar:
The purpose of DecompressionThresholdCvar is to store the actual value of the decompression threshold used by the audio system. It’s the backing variable for the au.DecompressionThreshold console variable.
This variable is used in the FAudioDevice::GetCompressionDurationThreshold function to determine the compression duration threshold. If DecompressionThresholdCvar is greater than 0.0f, it takes precedence over platform-specific settings.
The value of DecompressionThresholdCvar is set through the console variable system, initialized to 0.0f by default.
DecompressionThresholdCvar interacts directly with au.DecompressionThreshold, serving as its storage location.
Developers should be aware that modifying DecompressionThresholdCvar directly is not recommended. Instead, they should use the au.DecompressionThreshold console variable to change its value.
Best practices for DecompressionThresholdCvar include:
- Avoid direct manipulation; use the console variable system instead.
- When reading its value in code, consider that it might be 0.0f, in which case you should fall back to platform-specific settings.
- Use this variable in conjunction with platform-specific audio compression utilities for optimal audio performance across different platforms.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/Android/AndroidEngine.ini:18, section: [ConsoleVariables]
- INI Section:
ConsoleVariables
- Raw value:
0.05
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/IOS/IOSEngine.ini:13, section: [ConsoleVariables]
- INI Section:
ConsoleVariables
- Raw value:
0.05
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:88
Scope: file
Source code excerpt:
static float DecompressionThresholdCvar = 0.0f;
FAutoConsoleVariableRef CVarDecompressionThreshold(
TEXT("au.DecompressionThreshold"),
DecompressionThresholdCvar,
TEXT("If non-zero, overrides the decompression threshold set in either the sound group or the platform's runtime settings.\n")
TEXT("Value: Maximum duration we should fully decompress, in seconds."),
ECVF_Default);
static int32 RealtimeDecompressZeroDurationSoundsCvar = 0;
#Associated Variable and Callsites
This variable is associated with another variable named DecompressionThresholdCvar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:86
Scope: file
Source code excerpt:
ECVF_Default);
static float DecompressionThresholdCvar = 0.0f;
FAutoConsoleVariableRef CVarDecompressionThreshold(
TEXT("au.DecompressionThreshold"),
DecompressionThresholdCvar,
TEXT("If non-zero, overrides the decompression threshold set in either the sound group or the platform's runtime settings.\n")
TEXT("Value: Maximum duration we should fully decompress, in seconds."),
ECVF_Default);
static int32 RealtimeDecompressZeroDurationSoundsCvar = 0;
FAutoConsoleVariableRef CVarForceRealtimeDecompressOnZeroDuration(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:6731
Scope (from outer to inner):
file
function float FAudioDevice::GetCompressionDurationThreshold
Source code excerpt:
{
// Check to see if the compression duration threshold is overridden via CVar:
float CompressedDurationThreshold = DecompressionThresholdCvar;
// If not, check to see if there is an override for the compression duration on this platform in the project settings:
if (CompressedDurationThreshold <= 0.0f)
{
CompressedDurationThreshold = FPlatformCompressionUtilities::GetCompressionDurationForCurrentPlatform();
}