au.MetaSound.Frontend.DiscardStreamedRegistryTransactions

au.MetaSound.Frontend.DiscardStreamedRegistryTransactions

#Overview

name: au.MetaSound.Frontend.DiscardStreamedRegistryTransactions

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of au.MetaSound.Frontend.DiscardStreamedRegistryTransactions is to control whether MetaSound registry transactions are discarded after they have been streamed. This setting variable is part of the MetaSound system, which is a audio programming environment within Unreal Engine 5.

This setting variable is primarily used in the MetaSound plugin, specifically within the MetasoundFrontend module. Based on the callsites, it’s clear that this variable is utilized in the frontend registry transaction management system of MetaSound.

The value of this variable is set through a console variable (cvar) system. It’s initialized with a default value of 1 (enabled) but can be changed at runtime through the console or configuration files.

The associated variable MetaSoundFrontendDiscardStreamedRegistryTransactionsCVar directly interacts with au.MetaSound.Frontend.DiscardStreamedRegistryTransactions. They share the same value, with the cvar acting as the interface for setting and querying the value.

Developers must be aware that when this variable is enabled (non-zero), MetaSound registry transactions will be discarded after streaming. This can impact memory usage and potentially the behavior of the MetaSound system, especially in scenarios where retaining transaction history might be necessary.

Best practices when using this variable include:

  1. Consider the impact on memory usage and system behavior before changing the default value.
  2. Monitor system performance when adjusting this setting, especially in memory-constrained environments.
  3. Use this setting in conjunction with other MetaSound configuration options for optimal performance.

Regarding the associated variable MetaSoundFrontendDiscardStreamedRegistryTransactionsCVar:

This is an integer variable that directly corresponds to the console variable. It’s used internally within the MetaSound frontend code to check whether transactions should be discarded. The variable is declared externally and used in the TTransactionBuffer class to determine when to remove transactions that have been streamed to all readers.

When working with this variable, developers should:

  1. Understand that changing this variable will directly affect the behavior controlled by the console variable.
  2. Be cautious when modifying its value directly in code, as it’s generally preferable to use the console variable interface for runtime adjustments.
  3. Consider the implications on transaction management and memory usage when utilizing this variable in custom MetaSound implementations or extensions.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/Metasound/Source/MetasoundFrontend/Private/MetasoundFrontendRegistryTransaction.cpp:10

Scope (from outer to inner):

file
namespace    Metasound
namespace    Frontend

Source code excerpt:


		FAutoConsoleVariableRef CVarMetaSoundFrontendDiscardStreamedRegistryTransactions(
			TEXT("au.MetaSound.Frontend.DiscardStreamedRegistryTransactions"),
			MetaSoundFrontendDiscardStreamedRegistryTransactionsCVar,
			TEXT("If enabled, MetaSound registry transactions are discarded after they have been streamed.\n")
			TEXT("0: Disabled, !0: Enabled (default)"),
			ECVF_Default);
	}
}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/Metasound/Source/MetasoundFrontend/Private/MetasoundFrontendRegistryTransaction.cpp:7

Scope (from outer to inner):

file
namespace    Metasound
namespace    Frontend

Source code excerpt:

	namespace Frontend
	{
		int32 MetaSoundFrontendDiscardStreamedRegistryTransactionsCVar = 1;

		FAutoConsoleVariableRef CVarMetaSoundFrontendDiscardStreamedRegistryTransactions(
			TEXT("au.MetaSound.Frontend.DiscardStreamedRegistryTransactions"),
			MetaSoundFrontendDiscardStreamedRegistryTransactionsCVar,
			TEXT("If enabled, MetaSound registry transactions are discarded after they have been streamed.\n")
			TEXT("0: Disabled, !0: Enabled (default)"),
			ECVF_Default);
	}
}

#Loc: <Workspace>/Engine/Plugins/Runtime/Metasound/Source/MetasoundFrontend/Private/MetasoundFrontendRegistryTransaction.h:15

Scope (from outer to inner):

file
namespace    Metasound
namespace    Frontend

Source code excerpt:

	namespace Frontend
	{
		extern int32 MetaSoundFrontendDiscardStreamedRegistryTransactionsCVar;
		extern FAutoConsoleVariableRef CVarMetaSoundFrontendDiscardStreamedRegistryTransactions;

		using FTransactionReaderHandle = uint32;

		/** Maintains a limited history of TransactionTypes. Calls are threadsafe (excluding
		 * the constructor and destructor.)

#Loc: <Workspace>/Engine/Plugins/Runtime/Metasound/Source/MetasoundFrontend/Private/MetasoundFrontendRegistryTransaction.h:125

Scope (from outer to inner):

file
namespace    Metasound
namespace    Frontend
class        class TTransactionBuffer
function     void RemoveTransactionsStreamedToAllReaders

Source code excerpt:

			void RemoveTransactionsStreamedToAllReaders()
			{
				if (0 != MetaSoundFrontendDiscardStreamedRegistryTransactionsCVar)
				{
					const auto* MinElement = Algo::MinElementBy(ReaderPositions, [](const auto& Pair){return Pair.Value;});
					if (nullptr != MinElement)
					{
						int32 NumToRemove = (MinElement->Value) - NumRemovedTransactions;
						if (NumToRemove > 0)