au.itd.EnableILD

au.itd.EnableILD

#Overview

name: au.itd.EnableILD

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.itd.EnableILD is to control the use of Interaural Level Difference (ILD) in the spatialization of audio sources. It is specifically used in the audio rendering system to enhance the perception of sound directionality.

This setting variable is primarily used in the Spatialization plugin, which is part of Unreal Engine’s audio system. Based on the callsites, it’s clear that this variable is utilized within the ITDSpatializer.cpp file, which is responsible for implementing interaural time difference (ITD) based spatialization.

The value of this variable is set through a console variable system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using the console command “au.itd.EnableILD”.

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

Developers must be aware that this variable is a binary switch (0 or 1) that enables or disables the use of level differences in addition to delay for spatial audio processing. When disabled (set to 0), the system will only use time delays for spatialization, potentially reducing the perceived directionality of sounds.

Best practices when using this variable include:

  1. Understanding the impact on audio quality and performance before changing its value.
  2. Testing the audio experience with both settings (0 and 1) to determine the best option for your specific game or application.
  3. Considering the target platform and its capabilities when deciding whether to enable or disable ILD.

Regarding the associated variable EnableILDCVar:

The purpose of EnableILDCVar is to serve as the actual integer storage for the au.itd.EnableILD console variable within the C++ code.

This variable is used directly in the ITDSpatializer.cpp file, which is part of the Spatialization plugin in the Unreal Engine audio system.

The value of EnableILDCVar is set through the FAutoConsoleVariableRef system, which links it to the au.itd.EnableILD console variable.

EnableILDCVar interacts directly with the logic in the FSourceSpatializer::EvaluateGainDestinations function, where it determines whether to apply ILD processing.

Developers should be aware that changes to au.itd.EnableILD will directly affect the value of EnableILDCVar, and vice versa.

Best practices for using EnableILDCVar include:

  1. Avoid modifying EnableILDCVar directly in code; instead, use the console variable system to ensure consistency.
  2. When reading the value in code, always use EnableILDCVar rather than trying to access the console variable directly for better performance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/Spatialization/Source/Spatialization/Private/ITDSpatializer.cpp:35

Scope: file

Source code excerpt:

static int32 EnableILDCVar = 1;
FAutoConsoleVariableRef CVarEnablePanning(
	TEXT("au.itd.EnableILD"),
	EnableILDCVar,
	TEXT("Sets whether we should use level differences in addition to delay.\n")
	TEXT("0: ILD disabled, 1: ILD enabled."),
	ECVF_Default);

FSourceSpatializer::FSourceSpatializer()

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/Spatialization/Source/Spatialization/Private/ITDSpatializer.cpp:33

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 EnableILDCVar = 1;
FAutoConsoleVariableRef CVarEnablePanning(
	TEXT("au.itd.EnableILD"),
	EnableILDCVar,
	TEXT("Sets whether we should use level differences in addition to delay.\n")
	TEXT("0: ILD disabled, 1: ILD enabled."),
	ECVF_Default);

FSourceSpatializer::FSourceSpatializer()
{

#Loc: <Workspace>/Engine/Plugins/Runtime/Spatialization/Source/Spatialization/Private/ITDSpatializer.cpp:142

Scope (from outer to inner):

file
function     void FSourceSpatializer::EvaluateGainDestinations

Source code excerpt:

	const FRichCurve* InRichCurve = CurrentILDCurve.GetRichCurveConst();

	if (!EnableILDCVar || !InRichCurve)
	{
		LeftGain.SetValue(1.0f);
		RightGain.SetValue(1.0f);
		return;
	}