au.UseListenerOverrideForSpread

au.UseListenerOverrideForSpread

#Overview

name: au.UseListenerOverrideForSpread

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.UseListenerOverrideForSpread is to control the distance used for stereo panning in audio attenuation calculations. It is part of the audio system in Unreal Engine 5, specifically the AudioMixer module.

This setting variable is primarily used in the AudioMixer module, which is responsible for mixing and processing audio in Unreal Engine. Based on the callsites, it’s clear that this variable is used in the FMixerSource class, which handles individual audio sources in the mixer.

The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 and can be changed at runtime using console commands or through code.

The associated variable UseListenerOverrideForSpreadCVar directly interacts with au.UseListenerOverrideForSpread. They share the same value, with UseListenerOverrideForSpreadCVar being the actual int32 variable used in the C++ code.

Developers must be aware that this variable affects how stereo spread is calculated for audio sources. When set to 0 (default), it uses the actual distance between the listener and the sound source for panning calculations. When set to 1, it uses a listener override distance.

Best practices when using this variable include:

  1. Understanding the implications on audio spatialization before changing its value.
  2. Testing the audio experience with both settings (0 and 1) to determine which provides the best results for your specific use case.
  3. Documenting any changes to this variable in your project, as it can significantly affect the audio experience.

Regarding the associated variable UseListenerOverrideForSpreadCVar:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSource.cpp:42

Scope: file

Source code excerpt:

static int32 UseListenerOverrideForSpreadCVar = 0;
FAutoConsoleVariableRef CVarUseListenerOverrideForSpread(
	TEXT("au.UseListenerOverrideForSpread"),
	UseListenerOverrideForSpreadCVar,
	TEXT("Zero attenuation override distance stereo panning\n")
	TEXT("0: Use actual distance, 1: use listener override"),
	ECVF_Default);

static uint32 AudioMixerSourceFadeMinCVar = 512;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSource.cpp:40

Scope: file

Source code excerpt:



static int32 UseListenerOverrideForSpreadCVar = 0;
FAutoConsoleVariableRef CVarUseListenerOverrideForSpread(
	TEXT("au.UseListenerOverrideForSpread"),
	UseListenerOverrideForSpreadCVar,
	TEXT("Zero attenuation override distance stereo panning\n")
	TEXT("0: Use actual distance, 1: use listener override"),
	ECVF_Default);

static uint32 AudioMixerSourceFadeMinCVar = 512;
static FAutoConsoleCommand GSetAudioMixerSourceFadeMin(

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSource.cpp:2105

Scope (from outer to inner):

file
namespace    Audio
function     bool FMixerSource::ComputeStereoChannelMap

Source code excerpt:

				float RightAzimuth = 270.0f;

				const float DistanceToUse = UseListenerOverrideForSpreadCVar ? WaveInstance->ListenerToSoundDistance : WaveInstance->ListenerToSoundDistanceForPanning;

				if (DistanceToUse > KINDA_SMALL_NUMBER)
				{
					AzimuthOffset = FMath::Atan(0.5f * WaveInstance->StereoSpread / DistanceToUse);
					AzimuthOffset = FMath::RadiansToDegrees(AzimuthOffset);