au.streamcaching.StreamCacheSizeOverrideMB

au.streamcaching.StreamCacheSizeOverrideMB

#Overview

name: au.streamcaching.StreamCacheSizeOverrideMB

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of au.streamcaching.StreamCacheSizeOverrideMB is to override the size of the audio streaming cache in Unreal Engine 5. This setting variable is part of the audio streaming system, which is responsible for managing the memory used for streaming audio assets.

This setting variable is primarily used in the Engine module, specifically within the audio streaming cache subsystem. It’s defined and referenced in the AudioStreamingCache.cpp file, which is part of the audio streaming implementation.

The value of this variable is set through the Unreal Engine console variable (CVar) system. It can be modified at runtime using console commands or through configuration files.

The associated variable StreamCacheSizeOverrideMBCVar directly interacts with au.streamcaching.StreamCacheSizeOverrideMB. They share the same value, with StreamCacheSizeOverrideMBCVar being the actual float variable that stores the cache size override value.

Developers should be aware that:

  1. The default value is 0.0f, which means the cache size from project settings is used.
  2. Setting a value greater than 0 will override the cache size, specifying it in megabytes.
  3. This variable affects the memory usage of the audio streaming system, so it should be used carefully to avoid excessive memory consumption.

Best practices when using this variable include:

  1. Only override the cache size when necessary, as the project settings are typically optimized for most use cases.
  2. Monitor memory usage when modifying this value to ensure it doesn’t negatively impact overall performance.
  3. Consider the target platform’s memory constraints when setting a custom cache size.

Regarding the associated variable StreamCacheSizeOverrideMBCVar:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:104

Scope: file

Source code excerpt:

static float StreamCacheSizeOverrideMBCVar = 0.0f;
FAutoConsoleVariableRef CVarStreamCacheSizeOverrideMB(
	TEXT("au.streamcaching.StreamCacheSizeOverrideMB"),
	StreamCacheSizeOverrideMBCVar,
	TEXT("This cvar can be set to override the size of the cache.\n")
	TEXT("0: use cache size from project settings. n: the new cache size in megabytes."),
	ECVF_Default);

static int32 SaveAudioMemReportOnCacheOverflowCVar = 0;

#Associated Variable and Callsites

This variable is associated with another variable named StreamCacheSizeOverrideMBCVar. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:102

Scope: file

Source code excerpt:

	ECVF_Default);

static float StreamCacheSizeOverrideMBCVar = 0.0f;
FAutoConsoleVariableRef CVarStreamCacheSizeOverrideMB(
	TEXT("au.streamcaching.StreamCacheSizeOverrideMB"),
	StreamCacheSizeOverrideMBCVar,
	TEXT("This cvar can be set to override the size of the cache.\n")
	TEXT("0: use cache size from project settings. n: the new cache size in megabytes."),
	ECVF_Default);

static int32 SaveAudioMemReportOnCacheOverflowCVar = 0;
FAutoConsoleVariableRef CVarSaveAudiomemReportOnCacheOverflow(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:767

Scope (from outer to inner):

file
function     uint64 FAudioChunkCache::AddOrTouchChunk

Source code excerpt:

{
	// Update cache limit if needed.
	if (!FMath::IsNearlyZero(StreamCacheSizeOverrideMBCVar) && StreamCacheSizeOverrideMBCVar > 0.0f)
	{
		MemoryLimitBytes = ((uint64)(StreamCacheSizeOverrideMBCVar * 1024)) * 1024;
	}

	if (!InSoundWaveData.IsValid())
	{
		ExecuteOnLoadCompleteCallback(EAudioChunkLoadResult::ChunkOutOfBounds, OnLoadCompleted, CallbackThread);
		return InvalidAudioStreamCacheLookupID;