AutoStreamingThreshold
AutoStreamingThreshold
#Overview
name: AutoStreamingThreshold
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 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AutoStreamingThreshold is to control automatic streaming of audio assets in Unreal Engine. It is used to determine whether a sound file should be streamed from disk or loaded entirely into memory based on its duration.
This setting variable is primarily used in the audio system of Unreal Engine. It is referenced in various platform-specific modules and the core Engine module, indicating its importance across different target platforms.
The value of this variable is typically set in platform-specific configuration files or through the project settings interface. It can be found in classes like UWindowsTargetSettings, UAndroidRuntimeSettings, and UIOSRuntimeSettings, suggesting that it can be customized for different platforms.
AutoStreamingThreshold interacts with other audio-related variables, such as bStreaming and LoadingBehavior in the USoundWave class. It’s used in conjunction with these variables to determine the streaming behavior of audio assets.
Developers should be aware that:
- This threshold is measured in seconds.
- Setting it to a value greater than 0 will cause any sound files longer than this duration to be streamed from disk rather than loaded entirely into memory.
- The behavior can vary depending on the target platform and other audio settings.
Best practices when using this variable include:
- Carefully consider the balance between memory usage and streaming performance when setting this value.
- Adjust it based on the target platform’s capabilities and the specific needs of your project.
- Test thoroughly with different values to ensure optimal performance across various devices.
- Consider the impact on load times and runtime performance, especially for mobile platforms.
- Use in conjunction with other audio settings to fine-tune the overall audio performance of your game.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:321, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]
- INI Section:
/Script/WindowsTargetPlatform.WindowsTargetSettings
- Raw value:
0.000000
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Classes/WindowsTargetSettings.h:140
Scope (from outer to inner):
file
class class UWindowsTargetSettings : public UObject
Source code excerpt:
/** When set to anything beyond 0, this will ensure any SoundWaves longer than this value, in seconds, to stream directly off of the disk. */
UPROPERTY(GlobalConfig)
float AutoStreamingThreshold;
/** Quality Level to COOK SoundCues at (if set, all other levels will be stripped by the cooker). */
UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides", meta = (DisplayName = "Sound Cue Cook Quality"))
int32 SoundCueCookQualityIndex = INDEX_NONE;
};
#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:640
Scope (from outer to inner):
file
class class UAndroidRuntimeSettings : public UObject
Source code excerpt:
// When set to anything beyond 0, this will ensure any SoundWaves longer than this value, in seconds, to stream directly off of the disk.
UPROPERTY(GlobalConfig)
float AutoStreamingThreshold;
// Several Android graphics debuggers require configuration changes to be made to your application in order to operate. Choosing an option from this menu will configure your project to work with that graphics debugger.
UPROPERTY(GlobalConfig, EditAnywhere, Category = GraphicsDebugger)
TEnumAsByte<EAndroidGraphicsDebugger::Type> AndroidGraphicsDebugger;
/** The path to your Mali Graphics Debugger installation (eg C:/Program Files/ARM/Mali Developer Tools/Mali Graphics Debugger v4.2.0) */
#Loc: <Workspace>/Engine/Source/Runtime/AudioPlatformConfiguration/Private/AudioCompressionSettings.cpp:55
Scope (from outer to inner):
file
function void FPlatformAudioCookOverrides::GetHashSuffix
Source code excerpt:
FPCU::AppendHash(OutSuffix, TEXT("QMOD"), InOverrides->CompressionQualityModifier);
FPCU::AppendHash(OutSuffix, TEXT("CQLT"), InOverrides->SoundCueCookQualityIndex);
FPCU::AppendHash(OutSuffix, TEXT("ASTH"), InOverrides->AutoStreamingThreshold);
FPCU::AppendHash(OutSuffix, TEXT("INLC"), InOverrides->bInlineFirstAudioChunk);
FPCU::AppendHash(OutSuffix, TEXT("LCK1"), InOverrides->LengthOfFirstAudioChunkInSecs);
// FAudioStreamCachingSettings
FPCU::AppendHash(OutSuffix, TEXT("CSZE"), InOverrides->StreamCachingSettings.CacheSizeKB);
FPCU::AppendHash(OutSuffix, TEXT("LCF"), InOverrides->StreamCachingSettings.bForceLegacyStreamChunking);
#Loc: <Workspace>/Engine/Source/Runtime/AudioPlatformConfiguration/Public/AudioCompressionSettings.h:78
Scope: file
Source code excerpt:
// When set to any platform > 0.0, this will automatically set any USoundWave beyond this value to be streamed from disk.
// If StreamCaching is set to true, this will be used
float AutoStreamingThreshold;
// Wether to inline the first "Audio" chunk, which is typically chunk 1. (Only on assets marked retain-on-load with a size of audio in secs set)
bool bInlineFirstAudioChunk = false;
// This will decide how much data to put in the first audio chunk. Anything <= 0 will be ignored.
// Must be combined with bInlineFirstAudioChunk, this will decide how much data to put in the first chunk.
#Loc: <Workspace>/Engine/Source/Runtime/AudioPlatformConfiguration/Public/AudioCompressionSettings.h:94
Scope (from outer to inner):
file
function FPlatformAudioCookOverrides
Source code excerpt:
: bResampleForDevice(false)
, CompressionQualityModifier(1.0f)
, AutoStreamingThreshold(0.0f)
, bInlineFirstAudioChunk(false)
, LengthOfFirstAudioChunkInSecs(0.f)
{
PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Max, 48000);
PlatformSampleRates.Add(ESoundwaveSampleRateSettings::High, 32000);
PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Medium, 24000);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioCompressionSettingsUtils.cpp:163
Scope (from outer to inner):
file
function void CacheAudioCookOverrides
Source code excerpt:
}
float AutoStreamingThreshold = 0.0f;
if (PlatformFile->GetFloat(*CategoryName, TEXT("AutoStreamingThreshold"), AutoStreamingThreshold))
{
OutOverrides.AutoStreamingThreshold = AutoStreamingThreshold;
}
#if 1
//Cache sample rate map:
float RetrievedSampleRate = -1.0f;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1189
Scope (from outer to inner):
file
function void USoundWave::Serialize
Source code excerpt:
{
#if WITH_ENGINE
// If there is an AutoStreamingThreshold set for the platform we're cooking to,
// we use it to determine whether this USoundWave should be streaming:
const ITargetPlatform* CookingTarget = Ar.CookingTarget();
if (CookingTarget != nullptr)
{
bShouldStreamSound = IsStreaming(*CookingTarget->IniPlatformName());
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:3617
Scope (from outer to inner):
file
function bool USoundWave::IsStreaming
Source code excerpt:
{
// We stream if (A) bStreaming is set to true, (B) bForceInline is false and either bUseLoadOnDemand was set to true in
// our cook overrides, or the AutoStreamingThreshold was set and this sound is longer than the auto streaming threshold.
const bool bIsForceInline = LoadingBehavior == ESoundWaveLoadingBehavior::ForceInline;
const bool bIsForcedNonStreamingInEditor = (GIsEditor && ForceNonStreamingInEditorCVar != 0);
const bool bIsForcedNonStreaming = (bProcedural || bIsForceInline || bIsForcedNonStreamingInEditor);
if (bIsForcedNonStreaming)
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:587
Scope (from outer to inner):
file
class class UIOSRuntimeSettings : public UObject
Source code excerpt:
// When set to anything beyond 0, this will ensure any SoundWaves longer than this value, in seconds, to stream directly off of the disk.
UPROPERTY(GlobalConfig)
float AutoStreamingThreshold;
virtual void PostReloadConfig(class FProperty* PropertyThatWasLoaded) override;
#if WITH_EDITOR
// UObject interface
virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;