au.nrt.RenderEveryTick
au.nrt.RenderEveryTick
#Overview
name: au.nrt.RenderEveryTick
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When set to 1, calls the RenderAudio call every tick.\nn: Number of frames to render.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.nrt.RenderEveryTick is to control audio rendering behavior in non-realtime scenarios within Unreal Engine 5. Specifically, it determines whether the RenderAudio function should be called every tick in non-realtime audio rendering.
This setting variable is primarily used by the Non-Realtime Audio Renderer subsystem and the Movie Render Pipeline plugin. It’s part of the audio rendering system, particularly for scenarios where audio needs to be rendered outside of real-time gameplay.
The value of this variable is initially set to 1 in the NonRealtimeAudioRenderer module, but it can be modified at runtime through the console or programmatically.
The associated variable RenderEveryTickCvar directly interacts with au.nrt.RenderEveryTick. They share the same value, with RenderEveryTickCvar being the actual int32 variable that the engine checks to determine the rendering behavior.
Developers should be aware of several important points when using this variable:
- Setting it to 1 causes RenderAudio to be called every tick, which may be necessary for certain non-realtime rendering scenarios.
- The Movie Render Pipeline temporarily overrides this value to 0 during its rendering process to take control of when audio rendering occurs.
- The previous value is cached and restored after the Movie Render Pipeline completes its work.
Best practices for using this variable include:
- Only modify it when you specifically need to change the non-realtime audio rendering behavior.
- If you’re developing systems that interact with non-realtime audio rendering, always check the current value before making assumptions about the rendering behavior.
- If you modify the value, consider caching the previous value and restoring it when your operation is complete, similar to how the Movie Render Pipeline handles it.
Regarding the associated variable RenderEveryTickCvar:
The purpose of RenderEveryTickCvar is to serve as the actual int32 variable that the engine checks to determine whether to render audio every tick in non-realtime scenarios.
It’s used directly within the Non-Realtime Audio Renderer module, specifically in the FMixerPlatformNonRealtime::OnHardwareUpdate function.
The value of RenderEveryTickCvar is set through the au.nrt.RenderEveryTick console variable.
This variable directly controls the behavior of the non-realtime audio renderer. When it’s non-zero, the RenderAudio function is called every tick.
Developers should be aware that modifying au.nrt.RenderEveryTick will directly affect the value of RenderEveryTickCvar.
Best practices for RenderEveryTickCvar are essentially the same as for au.nrt.RenderEveryTick, as they are tightly coupled. Any code that needs to check this setting should refer to RenderEveryTickCvar directly rather than trying to query the console variable value for performance reasons.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/NonRealtimeAudioRenderer/Private/AudioMixerPlatformNonRealtime.cpp:29
Scope: file
Source code excerpt:
static int32 RenderEveryTickCvar = 1;
FAutoConsoleVariableRef CVarRenderEveryTick(
TEXT("au.nrt.RenderEveryTick"),
RenderEveryTickCvar,
TEXT("When set to 1, calls the RenderAudio call every tick.\n")
TEXT("n: Number of frames to render."),
ECVF_Default);
namespace Audio
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/MovieGraphDefaultAudioRenderer.cpp:143
Scope (from outer to inner):
file
function void UMovieGraphDefaultAudioRenderer::SetupAudioRendering
Source code excerpt:
// Will be null if the NRT module wasn't loaded
if (IConsoleVariable* AudioRenderEveryTickCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("au.nrt.RenderEveryTick")))
{
AudioState.PrevRenderEveryTickValue = AudioRenderEveryTickCvar->GetInt();
// Override it to prevent it from automatically ticking, we'll control this below
AudioRenderEveryTickCvar->SetWithCurrentPriority(0);
}
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/MovieGraphDefaultAudioRenderer.cpp:168
Scope (from outer to inner):
file
function void UMovieGraphDefaultAudioRenderer::TeardownAudioRendering
Source code excerpt:
// This will be null if the NRT wasn't used (module not loaded)
if (IConsoleVariable* AudioRenderEveryTickCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("au.nrt.RenderEveryTick")))
{
AudioRenderEveryTickCvar->Set(AudioState.PrevRenderEveryTickValue, ECVF_SetByConstructor);
}
if (IConsoleVariable* NeverMuteNRTAudioCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("au.NeverMuteNonRealtimeAudioDevices")))
{
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineAudioRendering.cpp:43
Scope (from outer to inner):
file
function void UMoviePipeline::SetupAudioRendering
Source code excerpt:
FApp::SetUnfocusedVolumeMultiplier(1.f);
IConsoleVariable* AudioRenderEveryTickCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("au.nrt.RenderEveryTick"));
// Will be null if the NRT module wasn't loaded
if (AudioRenderEveryTickCvar)
{
AudioState.PrevRenderEveryTickValue = AudioRenderEveryTickCvar->GetInt();
// Override it to prevent it from automatically ticking, we'll control this below.
AudioRenderEveryTickCvar->Set(0, ECVF_SetByConstructor);
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineAudioRendering.cpp:59
Scope (from outer to inner):
file
function void UMoviePipeline::TeardownAudioRendering
Source code excerpt:
// Restore our cached CVar value.
IConsoleVariable* AudioRenderEveryTickCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("au.nrt.RenderEveryTick"));
// This will be null if the NRT wasn't used (module not loaded).
if (AudioRenderEveryTickCvar)
{
AudioRenderEveryTickCvar->Set(AudioState.PrevRenderEveryTickValue, ECVF_SetByConstructor);
#Associated Variable and Callsites
This variable is associated with another variable named RenderEveryTickCvar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/NonRealtimeAudioRenderer/Private/AudioMixerPlatformNonRealtime.cpp:27
Scope: file
Source code excerpt:
ECVF_Default);
static int32 RenderEveryTickCvar = 1;
FAutoConsoleVariableRef CVarRenderEveryTick(
TEXT("au.nrt.RenderEveryTick"),
RenderEveryTickCvar,
TEXT("When set to 1, calls the RenderAudio call every tick.\n")
TEXT("n: Number of frames to render."),
ECVF_Default);
namespace Audio
{
#Loc: <Workspace>/Engine/Source/Runtime/NonRealtimeAudioRenderer/Private/AudioMixerPlatformNonRealtime.cpp:296
Scope (from outer to inner):
file
namespace Audio
function void FMixerPlatformNonRealtime::OnHardwareUpdate
Source code excerpt:
void FMixerPlatformNonRealtime::OnHardwareUpdate()
{
if (RenderEveryTickCvar)
{
RenderAudio(TickDelta);
}
}
bool FMixerPlatformNonRealtime::IsNonRealtime() const