au.DisableAppVolume

au.DisableAppVolume

#Overview

name: au.DisableAppVolume

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.DisableAppVolume is to control whether the application volume is applied to the audio output in Unreal Engine. It’s primarily used in the audio system to manage volume settings.

This setting variable is utilized by the Engine’s audio subsystem, specifically within the FAudioDevice class. It’s part of the core audio functionality in Unreal Engine.

The value of this variable is set through the console variable system. It’s defined as a static integer (DisableAppVolumeCvar) and linked to the console variable “au.DisableAppVolume” using FAutoConsoleVariableRef.

The associated variable DisableAppVolumeCvar directly interacts with au.DisableAppVolume. They share the same value, with DisableAppVolumeCvar being the actual variable used in the code logic.

Developers must be aware that when this variable is set to 1, it disables the application volume adjustment. This means that the engine will not apply the global volume multiplier (FApp::GetVolumeMultiplier()) to the primary volume.

Best practices when using this variable include:

  1. Use it sparingly, only when you need to bypass the application’s volume control.
  2. Remember to reset it to 0 if you want to re-enable application volume control.
  3. Consider the implications on user experience when disabling application volume control.

Regarding the associated variable DisableAppVolumeCvar:

The purpose of DisableAppVolumeCvar is to serve as the actual integer storage for the au.DisableAppVolume setting. It’s used directly in the code logic to determine whether to apply the application volume multiplier.

This variable is used within the Engine’s audio subsystem, specifically in the FAudioDevice::Update function.

Its value is set through the console variable system, linked to “au.DisableAppVolume”.

It directly interacts with the au.DisableAppVolume console variable, serving as its backing storage.

Developers should be aware that this variable is used in a boolean context (if (!DisableAppVolumeCvar)), so any non-zero value will disable the application volume adjustment.

Best practices for using DisableAppVolumeCvar include:

  1. Avoid modifying it directly; instead, use the console variable “au.DisableAppVolume” to change its value.
  2. When reading its value in code, remember that it’s treated as a boolean (0 for false, any non-zero for true).
  3. Consider adding debug logging when this variable affects volume calculations to aid in troubleshooting.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

static int32 DisableAppVolumeCvar = 0;
FAutoConsoleVariableRef CVarDisableAppVolume(
	TEXT("au.DisableAppVolume"),
	DisableAppVolumeCvar,
	TEXT("Disables application volume when set to 1.\n")
	TEXT("0: App volume enabled, 1: App volume disabled"),
	ECVF_Default);

static int32 DisableAutomaticPrecacheCvar = 0;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 DisableAppVolumeCvar = 0;
FAutoConsoleVariableRef CVarDisableAppVolume(
	TEXT("au.DisableAppVolume"),
	DisableAppVolumeCvar,
	TEXT("Disables application volume when set to 1.\n")
	TEXT("0: App volume enabled, 1: App volume disabled"),
	ECVF_Default);

static int32 DisableAutomaticPrecacheCvar = 0;
FAutoConsoleVariableRef CVarDisableAutomaticPrecache(

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

Scope (from outer to inner):

file
function     void FAudioDevice::Update

Source code excerpt:

	PrimaryVolume = GetTransientPrimaryVolume();
	
	if (!DisableAppVolumeCvar)
	{
		PrimaryVolume *= FApp::GetVolumeMultiplier();
	}

	UpdateAudioPluginSettingsObjectCache();