NumStoppingSources
NumStoppingSources
#Overview
name: NumStoppingSources
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of NumStoppingSources is to control the number of audio sources reserved for stopping sounds in the Unreal Engine’s audio system. This setting variable is part of the audio management and performance optimization features of the engine.
NumStoppingSources is primarily used in the Audio subsystem of Unreal Engine. It is referenced in the AudioDevice and AudioSettings modules, which are core components of the engine’s audio system.
The value of this variable is initially set in the UAudioSettings class, which is part of the engine’s configuration system. It can be modified through the project settings in the Unreal Editor or programmatically at runtime.
NumStoppingSources interacts with the MaxSources variable, as seen in the GetMaxSources() function. The total number of available audio sources is the sum of MaxSources and NumStoppingSources.
Developers should be aware that this variable directly impacts audio performance and memory usage. Setting it too high may waste resources, while setting it too low might result in abrupt sound cutoffs when many sounds are playing simultaneously.
Best practices for using this variable include:
- Adjusting it based on the specific needs of your game or application. Games with many simultaneous sounds might benefit from a higher value.
- Monitoring audio performance and adjusting this value if issues with sound stopping are observed.
- Considering the target platform’s capabilities when setting this value, as lower-end devices may require a lower number of stopping sources.
- Using the Unreal Engine’s profiling tools to fine-tune this value for optimal performance.
- Documenting any changes to this value in your project’s audio design documentation to ensure consistency across the development team.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:263, section: [/Script/Engine.AudioSettings]
- INI Section:
/Script/Engine.AudioSettings
- Raw value:
8
- 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:216
Scope (from outer to inner):
file
class class UAudioSettings : public UDeveloperSettings
Source code excerpt:
*/
UPROPERTY(config, EditAnywhere, Category = "Audio", AdvancedDisplay)
uint32 NumStoppingSources;
/**
* The method to use when doing non-binaural or object-based panning.
*/
UPROPERTY(config, EditAnywhere, Category = "Panning", AdvancedDisplay)
EPanningMethod PanningMethod;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:337
Scope (from outer to inner):
file
function FAudioDevice::FAudioDevice
Source code excerpt:
FAudioDevice::FAudioDevice()
: NumStoppingSources(32)
, SampleRate(0)
, NumPrecacheFrames(MONO_PCM_BUFFER_SAMPLES)
, DeviceID(static_cast<Audio::FDeviceId>(INDEX_NONE))
, SourceDataOverridePluginInterface(nullptr)
, ReverbPluginInterface(nullptr)
, OcclusionInterface(nullptr)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:544
Scope (from outer to inner):
file
function bool FAudioDevice::Init
Source code excerpt:
Effects = CreateEffectsManager();
NumStoppingSources = GetDefault<UAudioSettings>()->NumStoppingSources;
}
else
{
// Stopping sources are not supported in the old audio engine
NumStoppingSources = 0;
}
{
LLM_SCOPE(ELLMTag::AudioMixerPlugins);
// Cache any plugin settings objects we have loaded
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:906
Scope (from outer to inner):
file
function int32 FAudioDevice::GetMaxSources
Source code excerpt:
int32 FAudioDevice::GetMaxSources() const
{
return MaxSources + NumStoppingSources;
}
TRange<float> FAudioDevice::GetGlobalPitchRange() const
{
return TRange<float>(GlobalMinPitch, GlobalMaxPitch);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:4761
Scope (from outer to inner):
file
function void FAudioDevice::Update
Source code excerpt:
SET_DWORD_STAT(STAT_AudioVirtualLoops, VirtualLoops.Num());
SET_DWORD_STAT(STAT_AudioMaxChannels, Channels);
SET_DWORD_STAT(STAT_AudioMaxStoppingSources, NumStoppingSources);
}
// now let the platform perform anything it needs to handle
{
TRACE_CPUPROFILER_EVENT_SCOPE(FAudioDevice_UpdateHardware);
UpdateHardware();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioSettings.cpp:39
Scope (from outer to inner):
file
function void UAudioSettings::AddDefaultSettings
Source code excerpt:
DefaultReverbSendLevel_DEPRECATED = 0.0f;
VoiPSampleRate = EVoiceSampleRate::Low16000Hz;
NumStoppingSources = 8;
}
#if WITH_EDITOR
void UAudioSettings::PreEditChange(FProperty* PropertyAboutToChange)
{
CachedSoundClass = DefaultSoundClassName;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/AudioDevice.h:1958
Scope (from outer to inner):
file
class class FAudioDevice : public FExec
Source code excerpt:
/** The number of sources to reserve for stopping sounds. */
int32 NumStoppingSources;
/** The sample rate of all the audio devices */
int32 SampleRate;
/** The platform specific audio settings. */
FAudioPlatformSettings PlatformSettings;