au.CommandBufferInitialCapacity

au.CommandBufferInitialCapacity

#Overview

name: au.CommandBufferInitialCapacity

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.CommandBufferInitialCapacity is to set the initial capacity of the command buffer in the audio mixer system of Unreal Engine 5. This setting variable is specifically used for the audio subsystem, particularly in the AudioMixer module.

The AudioMixer module relies on this setting variable, as evidenced by its usage in the AudioMixerSourceManager.cpp file. This suggests that it’s crucial for managing audio sources and their associated commands in the mixer.

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

The associated variable CommandBufferInitialCapacityCvar directly interacts with au.CommandBufferInitialCapacity. They share the same value, with CommandBufferInitialCapacityCvar being the actual storage for the setting.

Developers should be aware that this variable affects the initial capacity of the command buffer, which could impact memory usage and potentially performance of the audio system. It’s important to note that there’s a clamping function (GetCommandBufferInitialCapacity) that restricts the value between 0 and 10000, ensuring it stays within a reasonable range.

Best practices when using this variable include:

  1. Only modifying it if there’s a specific need to change the initial command buffer capacity.
  2. Monitoring performance and memory usage when adjusting this value.
  3. Using the console variable system to experiment with different values during development.
  4. Documenting any changes made to this setting in project configuration files.

Regarding the associated variable CommandBufferInitialCapacityCvar: Its purpose is to store the actual value of the au.CommandBufferInitialCapacity setting. It’s used internally by the AudioMixer module to retrieve the command buffer’s initial capacity. The value is set through the console variable system and is clamped to ensure it remains within acceptable bounds. Developers should not directly modify this variable, but instead use the au.CommandBufferInitialCapacity console variable to change its value. Best practices include using it only through the provided GetCommandBufferInitialCapacity function, which applies the necessary clamping.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

static int32 CommandBufferInitialCapacityCvar = 500;
FAutoConsoleVariableRef CVarCommandBufferInitialCapacity(
	TEXT("au.CommandBufferInitialCapacity"),
	CommandBufferInitialCapacityCvar,
	TEXT("How many elements to initialize the command buffer capacity with"),
	ECVF_Default);

static float AudioCommandExecTimeMsWarningThresholdCvar = 500.f;
FAutoConsoleVariableRef CVarAudioCommandExecTimeMsWarningThreshold(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 CommandBufferInitialCapacityCvar = 500;
FAutoConsoleVariableRef CVarCommandBufferInitialCapacity(
	TEXT("au.CommandBufferInitialCapacity"),
	CommandBufferInitialCapacityCvar,
	TEXT("How many elements to initialize the command buffer capacity with"),
	ECVF_Default);

static float AudioCommandExecTimeMsWarningThresholdCvar = 500.f;
FAutoConsoleVariableRef CVarAudioCommandExecTimeMsWarningThreshold(
	TEXT("au.AudioThreadCommand.ExecutionTimeWarningThresholdInMs"),

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

Scope (from outer to inner):

file
namespace    Audio
function     int32 GetCommandBufferInitialCapacity

Source code excerpt:

	int32 GetCommandBufferInitialCapacity()
	{
		return FMath::Clamp(CommandBufferInitialCapacityCvar, 0, 10000);
	}
	/*************************************************************************
	* FMixerSourceManager
	**************************************************************************/

	FMixerSourceManager::FMixerSourceManager(FMixerDevice* InMixerDevice)