au.FadeOutTimeoutMSec

au.FadeOutTimeoutMSec

#Overview

name: au.FadeOutTimeoutMSec

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.FadeOutTimeoutMSec is to set the amount of time to wait for the FadeOut Event to fire in the audio system of Unreal Engine 5. This setting variable is specifically related to the audio mixing functionality.

The Unreal Engine subsystem that relies on this setting variable is the Audio Mixer Core module, as evidenced by its usage in the AudioMixerCore/Private/AudioMixer.cpp file.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 2000 milliseconds (2 seconds) and can be modified at runtime through console commands or configuration files.

This variable interacts directly with its associated variable FadeoutTimeoutCVar. They share the same value, with au.FadeOutTimeoutMSec being the console-accessible name and FadeoutTimeoutCVar being the actual variable used in the code.

Developers must be aware that this variable determines the timeout duration for the audio fade-out operation. If the fade-out event doesn’t complete within this time frame, a warning message will be logged.

Best practices when using this variable include:

  1. Adjusting the value based on the specific needs of your game’s audio system.
  2. Monitoring for timeout warnings in the log to ensure the fade-out process is completing as expected.
  3. Considering the impact on user experience if the fade-out process takes too long or times out frequently.

Regarding the associated variable FadeoutTimeoutCVar:

The purpose of FadeoutTimeoutCVar is to serve as the internal representation of the au.FadeOutTimeoutMSec console variable within the code.

It is used directly in the IAudioMixerPlatformInterface::FadeOut function to determine how long to wait for the AudioFadeEvent to complete.

The value of FadeoutTimeoutCVar is set through the console variable system, mirroring the value of au.FadeOutTimeoutMSec.

FadeoutTimeoutCVar interacts directly with the AudioFadeEvent’s Wait function, controlling the maximum duration of the wait operation.

Developers should be aware that modifying FadeoutTimeoutCVar directly in the code is not recommended, as it may lead to inconsistencies with the console variable system. Instead, they should use the au.FadeOutTimeoutMSec console variable for any runtime adjustments.

Best practices for FadeoutTimeoutCVar include:

  1. Treating it as a read-only variable within the code, relying on the console variable system for modifications.
  2. Ensuring that any code using this variable can handle potential changes to its value at runtime.
  3. Considering the implications of very short or very long timeout values on the audio system’s behavior and performance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:120

Scope: file

Source code excerpt:

static int32 FadeoutTimeoutCVar = 2000;
FAutoConsoleVariableRef CVarFadeoutTimeout(
	TEXT("au.FadeOutTimeoutMSec"),
	FadeoutTimeoutCVar,
	TEXT("Amount of time to wait for the FadeOut Event to fire. \n"),
	ECVF_Default);

static float LinearGainScalarForFinalOututCVar = 1.0f;
FAutoConsoleVariableRef LinearGainScalarForFinalOutut(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:118

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 FadeoutTimeoutCVar = 2000;
FAutoConsoleVariableRef CVarFadeoutTimeout(
	TEXT("au.FadeOutTimeoutMSec"),
	FadeoutTimeoutCVar,
	TEXT("Amount of time to wait for the FadeOut Event to fire. \n"),
	ECVF_Default);

static float LinearGainScalarForFinalOututCVar = 1.0f;
FAutoConsoleVariableRef LinearGainScalarForFinalOutut(
	TEXT("au.LinearGainScalarForFinalOutut"),

#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:386

Scope (from outer to inner):

file
namespace    Audio
function     void IAudioMixerPlatformInterface::FadeOut

Source code excerpt:

		if (AudioFadeEvent != nullptr)
		{						
			if (!AudioFadeEvent->Wait(FadeoutTimeoutCVar))
			{
				UE_LOG(LogAudioMixer, Warning, TEXT("FadeOutEvent timed out"));
			}
		}

		FadeVolume = 0.0f;