bAllowPlayWhenSilent
bAllowPlayWhenSilent
#Overview
name: bAllowPlayWhenSilent
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 bAllowPlayWhenSilent is to control whether sounds are allowed to play at 0 volume in the Unreal Engine audio system. This setting variable is primarily used for audio management and performance optimization.
This setting variable is primarily used by the Unreal Engine’s audio subsystem, specifically within the FAudioDevice class and UAudioSettings class. These are part of the core Engine module.
The value of this variable is initially set in the UAudioSettings constructor (AudioSettings.cpp) and can be configured through the project settings in the Unreal Editor. It is then used to initialize the corresponding member variable in the FAudioDevice class during the audio device initialization.
bAllowPlayWhenSilent interacts with other audio-related variables and systems, particularly those handling sound playback and volume management. It doesn’t directly interact with other specific variables, but its state affects the overall behavior of the audio system.
Developers must be aware that enabling this setting (setting it to true) may impact performance, as it allows the audio system to process and update sounds even when they are silent. This could potentially lead to unnecessary CPU usage if not managed carefully.
Best practices when using this variable include:
- Consider the performance implications of enabling this feature, especially for resource-constrained platforms.
- Use this setting judiciously, enabling it only when necessary for specific gameplay or audio design requirements.
- If enabled, ensure that silent sounds are properly managed and stopped when no longer needed to avoid unnecessary processing.
- Be mindful of this setting when debugging audio-related issues, as it may affect the behavior of sound playback and updates.
- Document the use of this setting clearly in the project, as it may not be immediately obvious to other team members why silent sounds are being processed.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:260, section: [/Script/Engine.AudioSettings]
- INI Section:
/Script/Engine.AudioSettings
- Raw value:
True
- 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:201
Scope (from outer to inner):
file
class class UAudioSettings : public UDeveloperSettings
Source code excerpt:
/** Allows sounds to play at 0 volume. */
UPROPERTY(config, EditAnywhere, Category = "Audio", AdvancedDisplay)
uint32 bAllowPlayWhenSilent:1;
/** Disables master EQ effect in the audio DSP graph. */
UPROPERTY(config, EditAnywhere, Category = "Mix", AdvancedDisplay)
uint32 bDisableMasterEQ : 1;
/** Enables the surround sound spatialization calculations to include the center channel. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:388
Scope (from outer to inner):
file
function FAudioDevice::FAudioDevice
Source code excerpt:
, DeviceDeltaTime(0.0f)
, bHasActivatedReverb(false)
, bAllowPlayWhenSilent(true)
, bUseAttenuationForNonGameWorlds(false)
, ConcurrencyManager(this)
, OneShotCount(0)
, GlobalMinPitch(0.4f)
, GlobalMaxPitch(2.0f)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:524
Scope (from outer to inner):
file
function bool FAudioDevice::Init
Source code excerpt:
GlobalMaxPitch = FMath::Max(AudioSettings->GlobalMaxPitchScale, 0.0001f);
bAllowCenterChannel3DPanning = AudioSettings->bAllowCenterChannel3DPanning;
bAllowPlayWhenSilent = AudioSettings->bAllowPlayWhenSilent;
DefaultReverbSendLevel = AudioSettings->DefaultReverbSendLevel_DEPRECATED;
const FSoftObjectPath DefaultBaseSoundMixName = GetDefault<UAudioSettings>()->DefaultBaseSoundMix;
if (DefaultBaseSoundMixName.IsValid())
{
DefaultBaseSoundMix = LoadObject<USoundMix>(nullptr, *DefaultBaseSoundMixName.ToString());
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioSettings.cpp:22
Scope (from outer to inner):
file
function UAudioSettings::UAudioSettings
Source code excerpt:
AddDefaultSettings();
bAllowPlayWhenSilent = true;
bParameterInterfacesRegistered = false;
GlobalMinPitchScale = 0.4F;
GlobalMaxPitchScale = 2.0F;
DefaultAudioCompressionType = EDefaultAudioCompressionType::BinkAudio;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioSettings.cpp:36
Scope (from outer to inner):
file
function void UAudioSettings::AddDefaultSettings
Source code excerpt:
DefaultSettings.DisplayName = LOCTEXT("DefaultSettingsName", "Default");
QualityLevels.Add(DefaultSettings);
bAllowPlayWhenSilent = true;
DefaultReverbSendLevel_DEPRECATED = 0.0f;
VoiPSampleRate = EVoiceSampleRate::Low16000Hz;
NumStoppingSources = 8;
}
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/AudioDevice.h:1898
Scope (from outer to inner):
file
class class FAudioDevice : public FExec
function bool PlayWhenSilentEnabled
Source code excerpt:
/** Whether play when silent is enabled for all sounds associated with this audio device*/
bool PlayWhenSilentEnabled() const { return bAllowPlayWhenSilent; }
ENGINE_API bool IsMainAudioDevice() const;
/** Set whether or not we force the use of attenuation for non-game worlds (as by default we only care about game worlds) */
void SetUseAttenuationForNonGameWorlds(bool bInUseAttenuationForNonGameWorlds)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/AudioDevice.h:2200
Scope (from outer to inner):
file
class class FAudioDevice : public FExec
Source code excerpt:
/** Whether or not we're supporting zero volume wave instances */
uint8 bAllowPlayWhenSilent:1;
/** Whether or not we force the use of attenuation for non-game worlds (as by default we only care about game worlds) */
uint8 bUseAttenuationForNonGameWorlds:1;
/** The audio thread update delta time for this audio thread update tick. */