MaximumConcurrentStreams
MaximumConcurrentStreams
#Overview
name: MaximumConcurrentStreams
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MaximumConcurrentStreams is to control the number of streaming sounds that can be played simultaneously in the Unreal Engine audio system. It sets a limit on concurrent audio streams to manage system resources and performance.
This setting variable is primarily used by the Unreal Engine’s audio system, specifically within the audio streaming module. Based on the callsites, it’s utilized in the Engine module, particularly in the audio streaming management functionality.
The value of this variable is set in the UAudioSettings class, which is derived from UDeveloperSettings. This suggests that it can be configured through the project settings in the Unreal Engine editor.
MaximumConcurrentStreams interacts with the audio streaming system, particularly in the FLegacyAudioStreamingManager class. It’s used to determine whether new sound sources can be created and to manage the addition of streaming sound sources.
Developers should be aware that this variable directly impacts the number of simultaneous streaming sounds in their game. Setting it too high might lead to performance issues, while setting it too low could result in important sounds not being played.
Best practices when using this variable include:
- Carefully balancing the value based on the game’s audio requirements and target hardware capabilities.
- Monitoring performance impact when adjusting this value, especially on lower-end devices.
- Considering prioritization of sound streams if the game requires more concurrent streams than this limit allows.
- Using this in conjunction with other audio settings to optimize overall audio performance.
- Testing thoroughly across different scenarios to ensure critical sounds are not cut off due to this limit.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:1603, section: [/Script/Engine.AudioSettings]
- INI Section:
/Script/Engine.AudioSettings
- Raw value:
2
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:256, section: [/Script/Engine.AudioSettings]
- INI Section:
/Script/Engine.AudioSettings
- Raw value:
2
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/AudioSettings.h:186
Scope (from outer to inner):
file
class class UAudioSettings : public UDeveloperSettings
Source code excerpt:
/** How many streaming sounds can be played at the same time (if more are played they will be sorted by priority) */
UPROPERTY(config, EditAnywhere, Category="Audio", meta=(ClampMin=0))
int32 MaximumConcurrentStreams;
/** The value to use to clamp the min pitch scale */
UPROPERTY(config, EditAnywhere, Category = "Audio", meta = (ClampMin = 0.001, UIMin = 0.001, UIMax = 4.0))
float GlobalMinPitchScale;
/** The value to use to clamp the max pitch scale */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreaming.cpp:808
Scope (from outer to inner):
file
function bool FLegacyAudioStreamingManager::CanCreateSoundSource
Source code excerpt:
if (!MaxStreams)
{
MaxStreams = GetDefault<UAudioSettings>()->MaximumConcurrentStreams;
}
FScopeLock Lock(&CriticalSection);
// If the sound wave hasn't been added, or failed when trying to add during sound wave post load, we can't create a streaming sound source with this sound wave
if (!WaveInstance->WaveData || !StreamingSoundWaves.Contains(WaveInstance->WaveData))
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreaming.cpp:846
Scope (from outer to inner):
file
function void FLegacyAudioStreamingManager::AddStreamingSoundSource
Source code excerpt:
if (!MaxStreams)
{
MaxStreams = GetDefault<UAudioSettings>()->MaximumConcurrentStreams;
}
FScopeLock Lock(&CriticalSection);
// Add source sorted by priority so we can easily iterate over the amount of streams
// that are allowed