au.PatchBufferBlocks
au.PatchBufferBlocks
#Overview
name: au.PatchBufferBlocks
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Determines the number of blocks that fit in a patch buffer.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.PatchBufferBlocks is to determine the number of blocks that fit in a patch buffer within the Unreal Engine 5 audio mixer system.
This setting variable is primarily used in the audio mixer subsystem of Unreal Engine 5, specifically within the AudioMixer module. It directly affects the behavior of the FMixerDevice class, which is a core component of the audio mixing system.
The value of this variable is set through a console variable system. It’s initialized with a default value of 3, but can be changed at runtime using the console command system.
The au.PatchBufferBlocks variable interacts directly with the AudioMixerPatchBufferBlocks variable. They share the same value, with AudioMixerPatchBufferBlocks serving as the actual storage for the value, while au.PatchBufferBlocks is the console-accessible name for the setting.
Developers must be aware that changing this value will affect the size of patch buffers in the audio system. This could potentially impact audio performance and latency. It’s important to note that this setting is used in calculations for creating patch outputs, so changing it could have far-reaching effects on audio processing.
Best practices when using this variable include:
- Only modify it if you have a thorough understanding of the audio mixer system.
- Test thoroughly after any changes to ensure no negative impacts on audio quality or performance.
- Consider the target platform and hardware capabilities when adjusting this value.
Regarding the associated variable AudioMixerPatchBufferBlocks:
The purpose of AudioMixerPatchBufferBlocks is to store the actual value that determines the number of blocks in a patch buffer. It serves as the backend for the au.PatchBufferBlocks console variable.
This variable is used directly in the audio mixer subsystem, specifically in the FMixerDevice::MakePatch function. It’s used to calculate the size of patch outputs.
The value of AudioMixerPatchBufferBlocks is set initially to 3, but can be modified through the au.PatchBufferBlocks console variable.
AudioMixerPatchBufferBlocks interacts directly with au.PatchBufferBlocks, sharing the same value. It’s also used in calculations involving the number of frames and channels in the audio system.
Developers should be aware that this variable directly affects the size of patch outputs in the audio system. Changes to this value could impact memory usage and potentially audio performance.
Best practices for AudioMixerPatchBufferBlocks are similar to those for au.PatchBufferBlocks. It’s crucial to understand the implications of changes and to test thoroughly after any modifications.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:109
Scope: file
Source code excerpt:
static int32 AudioMixerPatchBufferBlocks = 3;
FAutoConsoleVariableRef CVarAudioMixerPatchBufferBlocks(
TEXT("au.PatchBufferBlocks"),
AudioMixerPatchBufferBlocks,
TEXT("Determines the number of blocks that fit in a patch buffer."),
ECVF_Default);
// Link to "Audio" profiling category
CSV_DECLARE_CATEGORY_MODULE_EXTERN(AUDIOMIXERCORE_API, Audio);
#Associated Variable and Callsites
This variable is associated with another variable named AudioMixerPatchBufferBlocks
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:107
Scope: file
Source code excerpt:
ECVF_Default);
static int32 AudioMixerPatchBufferBlocks = 3;
FAutoConsoleVariableRef CVarAudioMixerPatchBufferBlocks(
TEXT("au.PatchBufferBlocks"),
AudioMixerPatchBufferBlocks,
TEXT("Determines the number of blocks that fit in a patch buffer."),
ECVF_Default);
// Link to "Audio" profiling category
CSV_DECLARE_CATEGORY_MODULE_EXTERN(AUDIOMIXERCORE_API, Audio);
#Loc: <Workspace>/Engine/Source/Runtime/AudioMixer/Private/AudioMixerDevice.cpp:2798
Scope (from outer to inner):
file
namespace Audio
function FPatchOutputStrongPtr FMixerDevice::MakePatch
Source code excerpt:
// This should be the same number.
int32 MaxSizeFrames = FMath::Max(InFrames, SourceManager->GetNumOutputFrames()), MinSizeFrames = FMath::Min(InFrames, SourceManager->GetNumOutputFrames());
return MakeShared<Audio::FPatchOutput, ESPMode::ThreadSafe>(AudioMixerPatchBufferBlocks * InFrames * FMath::DivideAndRoundUp(MaxSizeFrames, MinSizeFrames) * InChannels, InGain);
}
FPatchOutputStrongPtr FMixerDevice::AddPatchForSubmix(uint32 InObjectId, float InPatchGain)
{
if (!ensure(IsAudioRenderingThread()))
{