au.MultithreadedPatching.PushCallsPerOutputCleanupCheck
au.MultithreadedPatching.PushCallsPerOutputCleanupCheck
#Overview
name: au.MultithreadedPatching.PushCallsPerOutputCleanupCheck
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of push calls (usually corrisponding to audio block updates)\nbefore checking if an output is ready to be destroyed. Default = 256
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.MultithreadedPatching.PushCallsPerOutputCleanupCheck is to control the frequency of checking whether an audio output is ready to be destroyed in the multithreaded patching system of Unreal Engine’s audio subsystem.
This setting variable is primarily used in the Signal Processing module of Unreal Engine, specifically within the multithreaded patching system for audio processing. It’s part of the audio engine’s optimization strategy for managing audio outputs.
The value of this variable is set through the Unreal Engine’s console variable system. It’s initialized with a default value of 256 but can be changed at runtime using console commands or through configuration files.
The associated variable MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar directly interacts with au.MultithreadedPatching.PushCallsPerOutputCleanupCheck. They share the same value, with the console variable system using MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar as the actual storage for the setting.
Developers should be aware that this variable affects the performance and memory management of the audio system. A lower value will cause more frequent checks for stale outputs, potentially improving memory usage but at the cost of increased CPU usage. A higher value will reduce the frequency of checks, which might be more efficient for CPU usage but could delay the cleanup of unused audio outputs.
Best practices when using this variable include:
- Keeping the default value unless specific performance issues are observed.
- If adjusting, monitor both CPU usage and memory consumption to find the optimal balance.
- Consider the nature of your game’s audio - games with rapidly changing audio scenes might benefit from a lower value, while those with more stable audio environments might prefer a higher value.
Regarding the associated variable MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar:
This is the actual integer variable that stores the value set by au.MultithreadedPatching.PushCallsPerOutputCleanupCheck. It’s used directly in the audio processing code to determine how often to check for stale outputs. The variable is used in the FPatchInput::PushAudio function to control a counter that triggers the cleanup check.
Developers should treat this variable as read-only in their code, as its value is managed by the console variable system. Any necessary adjustments should be made through the au.MultithreadedPatching.PushCallsPerOutputCleanupCheck console variable rather than directly modifying MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/SignalProcessing/Private/MultithreadedPatching.cpp:10
Scope: file
Source code excerpt:
static int32 MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar = 256;
FAutoConsoleVariableRef CVarMultithreadedPatchingPushCallsPerOutputCleanupCheck(
TEXT("au.MultithreadedPatching.PushCallsPerOutputCleanupCheck"),
MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar,
TEXT("Number of push calls (usually corrisponding to audio block updates)\n")
TEXT("before checking if an output is ready to be destroyed. Default = 256"),
ECVF_Default);
namespace Audio
#Associated Variable and Callsites
This variable is associated with another variable named MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/SignalProcessing/Private/MultithreadedPatching.cpp:8
Scope: file
Source code excerpt:
#include "HAL/Event.h"
static int32 MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar = 256;
FAutoConsoleVariableRef CVarMultithreadedPatchingPushCallsPerOutputCleanupCheck(
TEXT("au.MultithreadedPatching.PushCallsPerOutputCleanupCheck"),
MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar,
TEXT("Number of push calls (usually corrisponding to audio block updates)\n")
TEXT("before checking if an output is ready to be destroyed. Default = 256"),
ECVF_Default);
namespace Audio
{
#Loc: <Workspace>/Engine/Source/Runtime/SignalProcessing/Private/MultithreadedPatching.cpp:283
Scope (from outer to inner):
file
namespace Audio
function int32 FPatchInput::PushAudio
Source code excerpt:
// If the buffer is full, check as well to determine if it is possibly due to the
// output going stale between periodic push call counter checks.
const int32 PushCallsPerOutputCleanupCheck = FMath::Max(1, MultithreadedPatchingPushCallsPerOutputCleanupCheckCVar);
PushCallsCounter = (PushCallsCounter + 1) % PushCallsPerOutputCleanupCheck;
if (PushCallsCounter == 0 || SamplesPushed == 0)
{
if (OutputHandle.IsUnique())
{
// Deletes the output as it is the last remaining handle