au.DisableDistanceAttenuation

au.DisableDistanceAttenuation

#Overview

name: au.DisableDistanceAttenuation

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.DisableDistanceAttenuation is to control the distance attenuation feature in the Unreal Engine’s audio system. It allows developers to disable distance attenuation for all audio sources in the game.

This setting variable is primarily used by the Audio Mixer subsystem of Unreal Engine 5. It’s specifically referenced in the AudioMixerSourceManager, which is responsible for managing audio sources and their properties.

The value of this variable is set through the console variable system. It’s defined as a console variable (CVar) using FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

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

Developers must be aware that when this variable is set to 1, it completely disables distance attenuation for all audio sources. This can significantly affect the spatial audio experience in the game, as sounds will not become quieter with distance.

Best practices when using this variable include:

  1. Use it primarily for debugging or testing purposes.
  2. Be cautious about enabling it in production builds, as it can negatively impact the audio experience.
  3. If disabled for testing, remember to re-enable it before finalizing audio work.

Regarding the associated variable DisableDistanceAttenuationCvar:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSourceManager.cpp:71

Scope: file

Source code excerpt:

static int32 DisableDistanceAttenuationCvar = 0;
FAutoConsoleVariableRef CVarDisableDistanceAttenuation(
	TEXT("au.DisableDistanceAttenuation"),
	DisableDistanceAttenuationCvar,
	TEXT("Disables using any Distance Attenuation.\n")
	TEXT("0: Not Disabled, 1: Disabled"),
	ECVF_Default);

static int32 BypassAudioPluginsCvar = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSourceManager.cpp:69

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 DisableDistanceAttenuationCvar = 0;
FAutoConsoleVariableRef CVarDisableDistanceAttenuation(
	TEXT("au.DisableDistanceAttenuation"),
	DisableDistanceAttenuationCvar,
	TEXT("Disables using any Distance Attenuation.\n")
	TEXT("0: Not Disabled, 1: Disabled"),
	ECVF_Default);

static int32 BypassAudioPluginsCvar = 0;
FAutoConsoleVariableRef CVarBypassAudioPlugins(

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSourceManager.cpp:2439

Scope (from outer to inner):

file
namespace    Audio
function     void FMixerSourceManager::ApplyDistanceAttenuation

Source code excerpt:

	void FMixerSourceManager::ApplyDistanceAttenuation(FSourceInfo& SourceInfo, int32 NumSamples)
	{
		if (DisableDistanceAttenuationCvar)
		{
			return;
		}

		TArrayView<float> PostDistanceAttenBufferView(SourceInfo.SourceBuffer.GetData(), SourceInfo.SourceBuffer.Num());
		Audio::ArrayFade(PostDistanceAttenBufferView, SourceInfo.DistanceAttenuationSourceStart, SourceInfo.DistanceAttenuationSourceDestination);