au.CommandBufferFlushWaitTimeMs
au.CommandBufferFlushWaitTimeMs
#Overview
name: au.CommandBufferFlushWaitTimeMs
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
How long to wait for the command buffer flush to complete.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.CommandBufferFlushWaitTimeMs is to control the maximum waiting time for the audio mixer command buffer flush operation to complete. This setting variable is part of the audio system in Unreal Engine 5, specifically the AudioMixer module.
The AudioMixer subsystem relies on this setting variable, as evidenced by its usage in the AudioMixerSourceManager.cpp file. This file is part of the core audio processing functionality in Unreal Engine.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 1000 milliseconds (1 second) and can be modified at runtime using console commands.
The associated variable CommandBufferFlushWaitTimeMsCvar interacts directly with au.CommandBufferFlushWaitTimeMs. They share the same value, with CommandBufferFlushWaitTimeMsCvar being the actual integer variable used in the code, while au.CommandBufferFlushWaitTimeMs is the console variable name used for external access and modification.
Developers must be aware that this variable affects the timeout duration for flushing the audio command buffer. If set too low, it might cause premature timeouts in audio processing, potentially leading to audio glitches or missing sounds. If set too high, it could cause unnecessary delays in audio processing or game shutdown.
Best practices when using this variable include:
- Keeping the default value unless specific audio issues are encountered.
- If modifying, start with small increments and test thoroughly.
- Monitor audio performance and quality when adjusting this value.
- Consider platform-specific requirements, as audio processing capabilities may vary.
Regarding the associated variable CommandBufferFlushWaitTimeMsCvar:
The purpose of CommandBufferFlushWaitTimeMsCvar is to store the actual integer value used in the code for the command buffer flush wait time.
It is used directly in the AudioMixer subsystem, specifically in the FMixerSourceManager::FlushCommandQueue function.
The value of CommandBufferFlushWaitTimeMsCvar is set through the au.CommandBufferFlushWaitTimeMs console variable.
It interacts directly with au.CommandBufferFlushWaitTimeMs, serving as the backing variable for the console variable.
Developers should be aware that modifying CommandBufferFlushWaitTimeMsCvar directly in code would bypass the console variable system and might lead to inconsistencies.
Best practices for CommandBufferFlushWaitTimeMsCvar include:
- Avoid modifying it directly in code; use the console variable system instead.
- When reading its value in code, be aware that it might have been changed through the console variable system.
- Consider adding debug logging when this value is used in critical sections to aid in troubleshooting audio issues.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSourceManager.cpp:95
Scope: file
Source code excerpt:
static int32 CommandBufferFlushWaitTimeMsCvar = 1000;
FAutoConsoleVariableRef CVarCommandBufferFlushWaitTimeMs(
TEXT("au.CommandBufferFlushWaitTimeMs"),
CommandBufferFlushWaitTimeMsCvar,
TEXT("How long to wait for the command buffer flush to complete.\n"),
ECVF_Default);
static int32 CommandBufferMaxSizeInMbCvar = 10;
FAutoConsoleVariableRef CVarCommandBufferMaxSizeMb(
#Associated Variable and Callsites
This variable is associated with another variable named CommandBufferFlushWaitTimeMsCvar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSourceManager.cpp:93
Scope: file
Source code excerpt:
ECVF_Default);
static int32 CommandBufferFlushWaitTimeMsCvar = 1000;
FAutoConsoleVariableRef CVarCommandBufferFlushWaitTimeMs(
TEXT("au.CommandBufferFlushWaitTimeMs"),
CommandBufferFlushWaitTimeMsCvar,
TEXT("How long to wait for the command buffer flush to complete.\n"),
ECVF_Default);
static int32 CommandBufferMaxSizeInMbCvar = 10;
FAutoConsoleVariableRef CVarCommandBufferMaxSizeMb(
TEXT("au.CommandBufferMaxSizeInMb"),
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerSourceManager.cpp:3536
Scope (from outer to inner):
file
namespace Audio
function void FMixerSourceManager::FlushCommandQueue
Source code excerpt:
// Make sure current current executing
bool bTimedOut = false;
if (!CommandsProcessedEvent->Wait(CommandBufferFlushWaitTimeMsCvar))
{
CommandsProcessedEvent->Trigger();
bTimedOut = true;
UE_LOG(LogAudioMixer, Warning, TEXT("Timed out waiting to flush the source manager command queue (1)."));
}
else