au.DisableDeviceSwap
au.DisableDeviceSwap
#Overview
name: au.DisableDeviceSwap
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Disable device swap handling code for Audio Mixer on Windows.\n0: Not Enabled, 1: Enabled
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.DisableDeviceSwap is to control whether device swap handling code for the Audio Mixer on Windows is disabled or not. This setting variable is part of the audio system in Unreal Engine 5.
-
The Unreal Engine audio subsystem, specifically the Audio Mixer module, relies on this setting variable. It is used in the AudioMixerCore module.
-
The value of this variable is set through a console variable (CVar) system. It is initialized to 0 by default, meaning device swap handling is enabled.
-
This variable interacts with the associated variable DisableDeviceSwapCVar. They share the same value, with DisableDeviceSwapCVar being the actual integer variable that stores the setting.
-
Developers must be aware that setting this variable to 1 will disable the device swap handling code for the Audio Mixer on Windows. This could potentially affect how the audio system responds to changes in audio devices during runtime.
-
Best practices when using this variable include:
- Only disable device swap handling if there’s a specific reason to do so, as it may impact the audio system’s ability to adapt to hardware changes.
- Test thoroughly when changing this setting to ensure it doesn’t negatively impact the audio experience, especially on Windows platforms.
- Consider logging or debugging audio device changes when experimenting with this setting.
Regarding the associated variable DisableDeviceSwapCVar:
- Its purpose is to store the actual integer value of the au.DisableDeviceSwap setting.
- It is used directly in the IAudioMixer::ShouldIgnoreDeviceSwaps() function to determine whether device swaps should be ignored.
- The value is set through the console variable system and can be changed at runtime.
- Developers should be aware that this variable is checked to determine the behavior of device swap handling. A non-zero value means device swaps will be ignored.
- Best practices include using the console variable au.DisableDeviceSwap to modify this setting rather than directly manipulating DisableDeviceSwapCVar, as the console variable system provides better control and documentation.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:74
Scope: file
Source code excerpt:
static int32 DisableDeviceSwapCVar = 0;
FAutoConsoleVariableRef CVarDisableDeviceSwap(
TEXT("au.DisableDeviceSwap"),
DisableDeviceSwapCVar,
TEXT("Disable device swap handling code for Audio Mixer on Windows.\n")
TEXT("0: Not Enabled, 1: Enabled"),
ECVF_Default);
static int32 bUseThreadedDeviceSwapCVar = 1;
#Associated Variable and Callsites
This variable is associated with another variable named DisableDeviceSwapCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:72
Scope: file
Source code excerpt:
ECVF_Default);
static int32 DisableDeviceSwapCVar = 0;
FAutoConsoleVariableRef CVarDisableDeviceSwap(
TEXT("au.DisableDeviceSwap"),
DisableDeviceSwapCVar,
TEXT("Disable device swap handling code for Audio Mixer on Windows.\n")
TEXT("0: Not Enabled, 1: Enabled"),
ECVF_Default);
static int32 bUseThreadedDeviceSwapCVar = 1;
FAutoConsoleVariableRef CVarUseThreadedDeviceSwap(
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixerCore/Private/AudioMixer.cpp:891
Scope (from outer to inner):
file
namespace Audio
function bool IAudioMixer::ShouldIgnoreDeviceSwaps
Source code excerpt:
bool IAudioMixer::ShouldIgnoreDeviceSwaps()
{
return DisableDeviceSwapCVar != 0;
}
bool IAudioMixer::ShouldLogDeviceSwaps()
{
return EnableDetailedWindowsDeviceLoggingCVar != 0;
}