au.MaxConcurrentStreams
au.MaxConcurrentStreams
#Overview
name: au.MaxConcurrentStreams
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Overrides the max concurrent streams.\n0: Not Overridden, >0 Overridden
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.MaxConcurrentStreams is to control the maximum number of concurrent audio streams in the Unreal Engine’s audio system. This setting variable is used to override the default maximum concurrent streams value set in the audio settings.
This setting variable is primarily used in the audio streaming subsystem of Unreal Engine. It’s referenced in the AudioStreaming.cpp file, which is part of the Engine module.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0 and can be changed at runtime using console commands or through code.
The au.MaxConcurrentStreams variable interacts directly with the MaxConcurrentStreamsCvar variable. They share the same value, with MaxConcurrentStreamsCvar being the actual storage for the value, while au.MaxConcurrentStreams is the console-accessible name.
Developers must be aware that:
- A value of 0 means the setting is not overridden, and the engine will use the default value from UAudioSettings.
- Any value greater than 0 will override the default setting.
Best practices when using this variable include:
- Use it for performance tuning or debugging, not as a primary method of controlling audio streams in production.
- Be cautious when setting high values, as it may impact performance or memory usage.
- Consider the target platform’s capabilities when adjusting this value.
Regarding the associated variable MaxConcurrentStreamsCvar:
- It’s the actual storage variable for the au.MaxConcurrentStreams setting.
- It’s used in the CanCreateSoundSource and AddStreamingSoundSource functions to determine the maximum number of concurrent streams.
- If MaxConcurrentStreamsCvar is 0, these functions fall back to the value specified in UAudioSettings.
- Developers should not directly modify MaxConcurrentStreamsCvar, but instead use the au.MaxConcurrentStreams console variable to ensure proper synchronization between the two.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreaming.cpp:23
Scope: file
Source code excerpt:
static int32 MaxConcurrentStreamsCvar = 0;
FAutoConsoleVariableRef CVarMaxConcurrentStreams(
TEXT("au.MaxConcurrentStreams"),
MaxConcurrentStreamsCvar,
TEXT("Overrides the max concurrent streams.\n")
TEXT("0: Not Overridden, >0 Overridden"),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named MaxConcurrentStreamsCvar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreaming.cpp:21
Scope: file
Source code excerpt:
ECVF_Default);
static int32 MaxConcurrentStreamsCvar = 0;
FAutoConsoleVariableRef CVarMaxConcurrentStreams(
TEXT("au.MaxConcurrentStreams"),
MaxConcurrentStreamsCvar,
TEXT("Overrides the max concurrent streams.\n")
TEXT("0: Not Overridden, >0 Overridden"),
ECVF_Default);
/*------------------------------------------------------------------------------
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreaming.cpp:805
Scope (from outer to inner):
file
function bool FLegacyAudioStreamingManager::CanCreateSoundSource
Source code excerpt:
check(WaveInstance->IsStreaming());
int32 MaxStreams = MaxConcurrentStreamsCvar;
if (!MaxStreams)
{
MaxStreams = GetDefault<UAudioSettings>()->MaximumConcurrentStreams;
}
FScopeLock Lock(&CriticalSection);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreaming.cpp:843
Scope (from outer to inner):
file
function void FLegacyAudioStreamingManager::AddStreamingSoundSource
Source code excerpt:
if (WaveInstance && WaveInstance->IsStreaming())
{
int32 MaxStreams = MaxConcurrentStreamsCvar;
if (!MaxStreams)
{
MaxStreams = GetDefault<UAudioSettings>()->MaximumConcurrentStreams;
}
FScopeLock Lock(&CriticalSection);