au.RealtimeDecompressZeroDurationSounds

au.RealtimeDecompressZeroDurationSounds

#Overview

name: au.RealtimeDecompressZeroDurationSounds

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).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of au.RealtimeDecompressZeroDurationSounds is to control the decompression method for sound waves with an invalid (zero) duration in Unreal Engine’s audio system. This setting variable is part of the audio subsystem and affects how certain sound files are processed during runtime.

This setting variable is primarily used in the Engine’s audio device module, specifically within the FAudioDevice class. It’s referenced in the file AudioDevice.cpp, which is a core component of Unreal Engine’s audio system.

The value of this variable is set through the Unreal Engine’s console variable system. It’s initialized to 0 by default but can be changed at runtime through console commands or configuration files.

The associated variable RealtimeDecompressZeroDurationSoundsCvar directly interacts with au.RealtimeDecompressZeroDurationSounds. They share the same value, with RealtimeDecompressZeroDurationSoundsCvar being the actual integer variable that stores the setting’s value.

Developers must be aware that this variable affects the performance and behavior of sound playback for sounds with zero duration. When set to 1, it forces realtime decompression for these sounds, which might impact performance but could solve issues with certain sound files.

Best practices when using this variable include:

  1. Leave it at the default value (0) unless you encounter specific issues with zero-duration sounds.
  2. If you do enable it, monitor performance to ensure it doesn’t negatively impact your game’s audio processing.
  3. Use it in conjunction with proper sound file management to avoid having zero-duration sounds in the first place.

Regarding the associated variable RealtimeDecompressZeroDurationSoundsCvar:

The purpose of RealtimeDecompressZeroDurationSoundsCvar is to act as the actual storage for the au.RealtimeDecompressZeroDurationSounds setting. It’s an implementation detail of how Unreal Engine manages console variables.

This variable is used within the Engine’s audio device module, specifically in the ShouldUseRealtimeDecompression function of the FAudioDevice class.

The value of this variable is set through the console variable system, mirroring the value of au.RealtimeDecompressZeroDurationSounds.

It interacts directly with the au.RealtimeDecompressZeroDurationSounds console variable and is used in the logic that determines whether to use realtime decompression for a sound wave.

Developers should be aware that modifying this variable directly (rather than through the console variable system) could lead to inconsistent behavior.

Best practices include:

  1. Always modify the setting through the au.RealtimeDecompressZeroDurationSounds console variable rather than directly changing RealtimeDecompressZeroDurationSoundsCvar.
  2. Treat this variable as read-only in your code, using it only for checking the current setting.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/Android/AndroidEngine.ini:20, section: [ConsoleVariables]

Location: <Workspace>/Projects/Lyra/Config/IOS/IOSEngine.ini:14, section: [ConsoleVariables]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:96

Scope: file

Source code excerpt:

static int32 RealtimeDecompressZeroDurationSoundsCvar = 0;
FAutoConsoleVariableRef CVarForceRealtimeDecompressOnZeroDuration(
	TEXT("au.RealtimeDecompressZeroDurationSounds"),
	RealtimeDecompressZeroDurationSoundsCvar,
	TEXT("When set to 1, we will fallback to realtime decoding any sound waves with an invalid duration..\n")
	TEXT("0: Fully decompress sounds with a duration of 0, 1: realtime decompress sounds with a duration of 0."),
	ECVF_Default);

static int32 WaitForSoundWaveToLoadCvar = 1;

#Associated Variable and Callsites

This variable is associated with another variable named RealtimeDecompressZeroDurationSoundsCvar. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:94

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 RealtimeDecompressZeroDurationSoundsCvar = 0;
FAutoConsoleVariableRef CVarForceRealtimeDecompressOnZeroDuration(
	TEXT("au.RealtimeDecompressZeroDurationSounds"),
	RealtimeDecompressZeroDurationSoundsCvar,
	TEXT("When set to 1, we will fallback to realtime decoding any sound waves with an invalid duration..\n")
	TEXT("0: Fully decompress sounds with a duration of 0, 1: realtime decompress sounds with a duration of 0."),
	ECVF_Default);

static int32 WaitForSoundWaveToLoadCvar = 1;
FAutoConsoleVariableRef CVarWaitForSoundWaveToLoad(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:6753

Scope (from outer to inner):

file
function     bool FAudioDevice::ShouldUseRealtimeDecompression

Source code excerpt:

		((bDisableAudioCaching || DisablePCMAudioCaching()) ||
		(!SoundGroup.bAlwaysDecompressOnLoad &&
			(ForceRealtimeDecompressionCvar || SoundWave->Duration > CompressedDurationThreshold || (RealtimeDecompressZeroDurationSoundsCvar && SoundWave->Duration <= 0.0f))));
}

void FAudioDevice::StopSourcesUsingBuffer(FSoundBuffer* SoundBuffer)
{
	TRACE_CPUPROFILER_EVENT_SCOPE(FAudioDevice_StopSourcesUsingBuffer);