au.VirtualLoops.Enabled

au.VirtualLoops.Enabled

#Overview

name: au.VirtualLoops.Enabled

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of au.VirtualLoops.Enabled is to control whether virtualizing is supported for audio loops in Unreal Engine 5. This setting is part of the audio system, specifically for managing virtual audio loops.

This setting variable is primarily used in the Engine module, particularly in the audio subsystem. It’s referenced in the AudioVirtualLoop.cpp file, which suggests it’s closely tied to the virtual audio loop functionality.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) but can be changed at runtime through console commands or configuration files.

The au.VirtualLoops.Enabled setting interacts directly with the bVirtualLoopsEnabledCVar variable. They share the same value, with bVirtualLoopsEnabledCVar being the actual variable used in the code to check if virtual loops are enabled.

Developers should be aware that this setting affects the behavior of looping audio in the game. When enabled, it allows for the virtualization of audio loops, which can be beneficial for performance, especially in scenes with many audio sources.

Best practices when using this variable include:

  1. Consider the performance implications of enabling or disabling virtual audio loops.
  2. Test the audio behavior in your game with this setting both enabled and disabled to ensure desired results.
  3. Be mindful of how this setting interacts with other audio settings and the overall audio mix of your game.

Regarding the associated variable bVirtualLoopsEnabledCVar:

The purpose of bVirtualLoopsEnabledCVar is to serve as the actual boolean flag used in the code to determine if virtual audio loops are enabled.

This variable is used directly in the Engine module, specifically in the AudioVirtualLoop.cpp file. It’s checked in the Virtualize and IsEnabled functions of the FAudioVirtualLoop class.

The value of bVirtualLoopsEnabledCVar is set through the au.VirtualLoops.Enabled console variable. It’s initialized to 1 (true) by default.

bVirtualLoopsEnabledCVar interacts directly with the au.VirtualLoops.Enabled setting, effectively serving as its in-code representation.

Developers should be aware that this variable is the actual flag checked in the code when determining whether to virtualize audio loops. Any changes to au.VirtualLoops.Enabled will be reflected in this variable.

Best practices for using bVirtualLoopsEnabledCVar include:

  1. Avoid modifying this variable directly in code; instead, use the au.VirtualLoops.Enabled console variable to change its value.
  2. When debugging audio virtualization issues, check the value of this variable to ensure it reflects the desired state of virtual audio loop support.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioVirtualLoop.cpp:8

Scope: file

Source code excerpt:

static int32 bVirtualLoopsEnabledCVar = 1;
FAutoConsoleVariableRef CVarVirtualLoopsEnabled(
	TEXT("au.VirtualLoops.Enabled"),
	bVirtualLoopsEnabledCVar,
	TEXT("Enables or disables whether virtualizing is supported for audio loops.\n"),
	ECVF_Default);

static float VirtualLoopsPerfDistanceCVar = 15000.0f;
FAutoConsoleVariableRef CVarVirtualLoopsPerfDistance(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioVirtualLoop.cpp:6

Scope: file

Source code excerpt:



static int32 bVirtualLoopsEnabledCVar = 1;
FAutoConsoleVariableRef CVarVirtualLoopsEnabled(
	TEXT("au.VirtualLoops.Enabled"),
	bVirtualLoopsEnabledCVar,
	TEXT("Enables or disables whether virtualizing is supported for audio loops.\n"),
	ECVF_Default);

static float VirtualLoopsPerfDistanceCVar = 15000.0f;
FAutoConsoleVariableRef CVarVirtualLoopsPerfDistance(
	TEXT("au.VirtualLoops.PerfDistance"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioVirtualLoop.cpp:101

Scope (from outer to inner):

file
function     bool FAudioVirtualLoop::Virtualize

Source code excerpt:

	}

	if (!bVirtualLoopsEnabledCVar || InActiveSound.bIsPreviewSound || !InActiveSound.IsLooping())
	{
		return false;
	}

	if (InActiveSound.FadeOut != FActiveSound::EFadeOut::None || InActiveSound.bIsStopping)
	{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioVirtualLoop.cpp:184

Scope (from outer to inner):

file
function     bool FAudioVirtualLoop::IsEnabled

Source code excerpt:

bool FAudioVirtualLoop::IsEnabled()
{
	return bVirtualLoopsEnabledCVar != 0;
}

bool FAudioVirtualLoop::IsInAudibleRange(const FActiveSound& InActiveSound, const FAudioDevice* InAudioDevice)
{
	if (!InActiveSound.bAllowSpatialization)
	{