au.MetaSound.DisableWaveCachePriming

au.MetaSound.DisableWaveCachePriming

#Overview

name: au.MetaSound.DisableWaveCachePriming

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.MetaSound.DisableWaveCachePriming is to control the caching behavior of MetaSound wave assets. It is used within the MetaSound plugin, which is part of Unreal Engine’s audio system.

This setting variable is primarily used in the MetaSound plugin, specifically in the MetasoundEngine module. Based on the callsites, it’s clear that this variable affects the wave asset caching mechanism in MetaSound.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

The associated variable DisableMetasoundWaveAssetCachePriming directly interacts with au.MetaSound.DisableWaveCachePriming. They share the same value, with DisableMetasoundWaveAssetCachePriming being the actual int32 variable used in the code logic.

Developers must be aware that this variable is a boolean flag, where 0 (default) means enabled, and 1 means disabled. When enabled (0), the MetaSound wave asset cache priming will occur, which can potentially improve performance by pre-loading audio data.

Best practices when using this variable include:

  1. Leave it at the default value (0) unless there’s a specific reason to disable cache priming.
  2. If audio performance issues are observed, particularly with streaming audio, consider the impact of this setting.
  3. Use this variable for debugging or profiling audio performance, especially when dealing with MetaSound assets.

Regarding the associated variable DisableMetasoundWaveAssetCachePriming:

This is an internal static variable used to actually implement the functionality controlled by the console variable. It’s used in the FWaveAsset constructor to determine whether to prime the cache for streaming sound waves.

When DisableMetasoundWaveAssetCachePriming is 0 (cache priming enabled), the code checks if the sound wave is streaming and has multiple chunks. If so, it likely triggers some form of preloading or caching mechanism (the exact details are not visible in the provided code snippet).

Developers should not manipulate this variable directly, but instead use the au.MetaSound.DisableWaveCachePriming console variable to control its behavior. This ensures that the intended console variable system is used for configuration, maintaining consistency and allowing for runtime adjustments.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/Metasound/Source/MetasoundEngine/Private/MetasoundWave.cpp:13

Scope: file

Source code excerpt:

static int32 DisableMetasoundWaveAssetCachePriming = 0;
FAutoConsoleVariableRef CVarDisableMetasoundWaveAssetCachePriming(
	TEXT("au.MetaSound.DisableWaveCachePriming"),
	DisableMetasoundWaveAssetCachePriming,
	TEXT("Disables MetaSound Wave Cache Priming.\n")
	TEXT("0 (default): Enabled, 1: Disabled"),
	ECVF_Default);

namespace Metasound

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/Metasound/Source/MetasoundEngine/Private/MetasoundWave.cpp:11

Scope: file

Source code excerpt:



static int32 DisableMetasoundWaveAssetCachePriming = 0;
FAutoConsoleVariableRef CVarDisableMetasoundWaveAssetCachePriming(
	TEXT("au.MetaSound.DisableWaveCachePriming"),
	DisableMetasoundWaveAssetCachePriming,
	TEXT("Disables MetaSound Wave Cache Priming.\n")
	TEXT("0 (default): Enabled, 1: Disabled"),
	ECVF_Default);

namespace Metasound
{

#Loc: <Workspace>/Engine/Plugins/Runtime/Metasound/Source/MetasoundEngine/Private/MetasoundWave.cpp:48

Scope (from outer to inner):

file
namespace    Metasound
function     FWaveAsset::FWaveAsset

Source code excerpt:

					// is primed here in the hopes that the chunk is ready by the
					// time that the decoder attempts to decode audio.
					if (0 == DisableMetasoundWaveAssetCachePriming)
					{
						if (SoundWaveProxy->IsStreaming())
						{
							if (SoundWaveProxy->GetNumChunks() > 1)
							{
								if (FStreamingManagerCollection* StreamingMgr = IStreamingManager::Get_Concurrent())