au.UseThreadedDeviceSwap
au.UseThreadedDeviceSwap
#Overview
name: au.UseThreadedDeviceSwap
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Lets Device Swap go wide.0 off, 1 on
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.UseThreadedDeviceSwap is to control whether the audio device swap operation should be performed in a threaded manner. This setting is part of the audio system in Unreal Engine 5, specifically related to the AudioMixerCore module.
The Unreal Engine subsystem that relies on this setting variable is the audio mixer system, which is part of the AudioMixerCore module. This can be inferred from the file location (AudioMixer.cpp) and the namespace (Audio) where the variable is used.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1 (enabled) and can be changed at runtime through console commands or configuration files.
The au.UseThreadedDeviceSwap variable interacts directly with the bUseThreadedDeviceSwapCVar variable. They share the same value, with bUseThreadedDeviceSwapCVar being the actual variable used in the C++ code, while au.UseThreadedDeviceSwap is the console-accessible name.
Developers must be aware that this variable affects the performance and behavior of audio device swapping. When enabled (set to 1), it allows device swapping to occur in a threaded manner, which can potentially improve performance by allowing these operations to occur concurrently with other processes.
Best practices when using this variable include:
- Leaving it enabled (default value of 1) unless specific issues are encountered.
- Testing the audio performance and behavior with both settings (0 and 1) if audio-related issues occur, especially during device swapping.
- Considering the impact on different platforms, as threaded operations might behave differently across various systems.
Regarding the associated variable bUseThreadedDeviceSwapCVar:
The purpose of bUseThreadedDeviceSwapCVar is to serve as the actual C++ variable that controls the threaded device swap functionality within the audio mixer code.
This variable is used directly in the AudioMixerCore module, specifically in the IAudioMixer class.
The value of bUseThreadedDeviceSwapCVar is set through the console variable system, linked to the au.UseThreadedDeviceSwap CVar.
It interacts directly with the au.UseThreadedDeviceSwap console variable, sharing the same value.
Developers should be aware that this variable is used in the ShouldUseThreadedDeviceSwap() function of the IAudioMixer class, which likely determines the behavior of device swapping operations throughout the audio system.
Best practices for bUseThreadedDeviceSwapCVar include:
- Not modifying this variable directly in code, but rather using the console variable system to change its value.
- Using the ShouldUseThreadedDeviceSwap() function to check the current state of this setting in any audio-related code that might be affected by threaded device swapping.
- Considering the implications of changing this value on audio performance and stability across different platforms and hardware configurations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:82
Scope: file
Source code excerpt:
static int32 bUseThreadedDeviceSwapCVar = 1;
FAutoConsoleVariableRef CVarUseThreadedDeviceSwap(
TEXT("au.UseThreadedDeviceSwap"),
bUseThreadedDeviceSwapCVar,
TEXT("Lets Device Swap go wide.")
TEXT("0 off, 1 on"),
ECVF_Default);
static int32 bUseAudioDeviceInfoCacheCVar = 1;
#Associated Variable and Callsites
This variable is associated with another variable named bUseThreadedDeviceSwapCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:80
Scope: file
Source code excerpt:
ECVF_Default);
static int32 bUseThreadedDeviceSwapCVar = 1;
FAutoConsoleVariableRef CVarUseThreadedDeviceSwap(
TEXT("au.UseThreadedDeviceSwap"),
bUseThreadedDeviceSwapCVar,
TEXT("Lets Device Swap go wide.")
TEXT("0 off, 1 on"),
ECVF_Default);
static int32 bUseAudioDeviceInfoCacheCVar = 1;
FAutoConsoleVariableRef CVarUseAudioDeviceInfoCache(
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:901
Scope (from outer to inner):
file
namespace Audio
function bool IAudioMixer::ShouldUseThreadedDeviceSwap
Source code excerpt:
bool IAudioMixer::ShouldUseThreadedDeviceSwap()
{
return bUseThreadedDeviceSwapCVar != 0;
}
bool IAudioMixer::ShouldUseDeviceInfoCache()
{
#if PLATFORM_WINDOWS
return bUseAudioDeviceInfoCacheCVar != 0;