au.streamcaching.PlaybackRequestPriority
au.streamcaching.PlaybackRequestPriority
#Overview
name: au.streamcaching.PlaybackRequestPriority
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This cvar sets the default request priority for audio chunks that are about to play back, but aren\'t in the cache.\n0: High, 1: Normal, 2: Below Normal, 3: Low, 4: Min
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.streamcaching.PlaybackRequestPriority is to set the default request priority for audio chunks that are about to play back but aren’t currently in the cache. This variable is part of Unreal Engine’s audio streaming system, specifically the audio caching subsystem.
This setting variable is primarily used in the Engine module, particularly in the audio streaming cache implementation. It’s referenced in the AudioStreamingCache.cpp file, which is part of the core engine’s audio system.
The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 and can be changed at runtime through console commands or configuration files.
The associated variable PlaybackRequestPriorityCVar directly interacts with au.streamcaching.PlaybackRequestPriority. They share the same value, with PlaybackRequestPriorityCVar being the actual integer variable used in the code, while au.streamcaching.PlaybackRequestPriority is the console variable name used for setting and accessing this value.
Developers must be aware that this variable affects the prioritization of audio chunk loading. The priority levels are: 0: High 1: Normal 2: Below Normal 3: Low 4: Min
This prioritization is used in the GetAsyncPriorityForChunk function to determine the async I/O priority for loading audio chunks needed for playback.
Best practices when using this variable include:
- Consider the performance implications of setting higher priorities, as it may affect other system resources.
- Use higher priorities (0 or 1) for critical audio that must not be interrupted or delayed.
- Use lower priorities (3 or 4) for less important background audio or ambient sounds.
- Monitor and profile the audio system performance to find the optimal setting for your specific game requirements.
Regarding the associated variable PlaybackRequestPriorityCVar:
The purpose of PlaybackRequestPriorityCVar is to store the actual integer value of the priority setting within the C++ code. It’s the internal representation of the au.streamcaching.PlaybackRequestPriority console variable.
This variable is used directly in the Engine module, specifically in the audio streaming cache implementation (AudioStreamingCache.cpp).
Its value is set through the console variable system, initialized to 0, and can be modified at runtime.
PlaybackRequestPriorityCVar interacts directly with au.streamcaching.PlaybackRequestPriority, essentially serving as its backing store.
Developers should be aware that modifying PlaybackRequestPriorityCVar directly in code is not the intended way to change this setting. Instead, they should use the console variable system to ensure consistency across the engine.
Best practices for PlaybackRequestPriorityCVar include:
- Treat it as read-only in most code contexts.
- Use the console variable system to modify its value rather than changing it directly.
- When reading its value in performance-critical code, consider caching the value locally if it’s used frequently, as accessing console variables can have a small performance cost.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:64
Scope: file
Source code excerpt:
static int32 PlaybackRequestPriorityCVar = 0;
FAutoConsoleVariableRef CVarPlaybackRequestPriority(
TEXT("au.streamcaching.PlaybackRequestPriority"),
PlaybackRequestPriorityCVar,
TEXT("This cvar sets the default request priority for audio chunks that are about to play back, but aren't in the cache.\n")
TEXT("0: High, 1: Normal, 2: Below Normal, 3: Low, 4: Min"),
ECVF_Default);
static int32 BlockForPendingLoadOnCacheOverflowCVar = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ContentStreaming.h:566
Scope: file
Source code excerpt:
* @param ChunkIndex Index of the chunk we want
* @param bBlockForLoad if true, will block this thread until we finish loading this chunk.
* @param bForImmediatePlayback if true, will optionally reprioritize this chunk's load request. See au.streamcaching.PlaybackRequestPriority.
* @return a handle to the loaded chunk. Can return a default constructed FAudioChunkHandle if the chunk is not loaded yet.
*/
virtual FAudioChunkHandle GetLoadedChunk(const FSoundWaveProxyPtr& SoundWave, uint32 ChunkIndex, bool bBlockForLoad = false, bool bForImmediatePlayback = false) const = 0;
/**
* This will start evicting elements from the cache until either hit our target of bytes or run out of chunks we can free.
*
* @param NumBytesToFree The amount of memory we would like to free, in bytes.
* @return the amount of bytes we managed to free.
*/
virtual uint64 TrimMemory(uint64 NumBytesToFree) = 0;
/**
* Used for rendering debug info:
#Associated Variable and Callsites
This variable is associated with another variable named PlaybackRequestPriorityCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:62
Scope: file
Source code excerpt:
ECVF_Default);
static int32 PlaybackRequestPriorityCVar = 0;
FAutoConsoleVariableRef CVarPlaybackRequestPriority(
TEXT("au.streamcaching.PlaybackRequestPriority"),
PlaybackRequestPriorityCVar,
TEXT("This cvar sets the default request priority for audio chunks that are about to play back, but aren't in the cache.\n")
TEXT("0: High, 1: Normal, 2: Below Normal, 3: Low, 4: Min"),
ECVF_Default);
static int32 BlockForPendingLoadOnCacheOverflowCVar = 0;
FAutoConsoleVariableRef CVarBlockForPendingLoadOnCacheOverflow(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:1931
Scope (from outer to inner):
file
function EAsyncIOPriorityAndFlags FAudioChunkCache::GetAsyncPriorityForChunk
Source code excerpt:
if (bNeededForPlayback)
{
switch (PlaybackRequestPriorityCVar)
{
case 4:
{
return AIOP_MIN;
}
case 3: