au.adpcm.DisableSeekForwardOnReadMisses
au.adpcm.DisableSeekForwardOnReadMisses
#Overview
name: au.adpcm.DisableSeekForwardOnReadMisses
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When there is a seek pending and this CVar is set to 0, we will scan forward in the file.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.adpcm.DisableSeekForwardOnReadMisses is to control the behavior of the ADPCM (Adaptive Differential Pulse-Code Modulation) audio decoder when there are read misses during streaming of compressed audio data.
This setting variable is primarily used in the audio system of Unreal Engine, specifically in the ADPCM audio decoder module. Based on the callsites, it’s part of the AdpcmAudioDecoder runtime module.
The value of this variable is set through the Unreal Engine’s console variable (CVar) system. It’s initialized with a default value of 1, which means the “seek forward” behavior is disabled by default.
The associated variable ADPCMDisableSeekForwardOnChunkMissesCVar directly interacts with au.adpcm.DisableSeekForwardOnReadMisses. They share the same value, with ADPCMDisableSeekForwardOnChunkMissesCVar being the C++ variable that’s used in the actual logic.
Developers must be aware that when this variable is set to 0, the system will scan forward in the file when there is a seek pending. This can affect performance and how audio data is processed, especially in scenarios where there are frequent read misses.
Best practices when using this variable include:
- Only modify it if you’re experiencing issues with ADPCM audio playback or streaming.
- Monitor performance when changing this value, as it can affect how aggressively the system seeks through audio data.
- Use in conjunction with other ADPCM-related settings for optimal audio streaming performance.
Regarding the associated variable ADPCMDisableSeekForwardOnChunkMissesCVar:
- Its purpose is to provide a C++ accessible version of the console variable.
- It’s used directly in the audio streaming logic to determine whether to seek forward when chunk misses occur.
- The value is set by the console variable system and can be changed at runtime.
- It interacts closely with another variable, ADPCMOnlySeekForwardOneChunkCVar, to prevent excessive seeking.
- Developers should be cautious when modifying this variable directly in code, as it’s intended to be controlled via the console variable system.
- Best practices include using the console variable for runtime adjustments and only modifying the C++ variable if absolutely necessary for specialized audio streaming behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AdpcmAudioDecoder/Module/Private/ADPCMAudioInfo.cpp:20
Scope: file
Source code excerpt:
static int32 ADPCMDisableSeekForwardOnChunkMissesCVar = 1;
FAutoConsoleVariableRef CVarADPCMDisableSeekForwardOnChunkMisses(
TEXT("au.adpcm.DisableSeekForwardOnReadMisses"),
ADPCMDisableSeekForwardOnChunkMissesCVar,
TEXT("When there is a seek pending and this CVar is set to 0, we will scan forward in the file.\n"),
ECVF_Default);
static int32 ADPCMOnlySeekForwardOneChunkCVar = 1;
FAutoConsoleVariableRef CVarADPCMOnlySeekForwardOneChunk(
#Associated Variable and Callsites
This variable is associated with another variable named ADPCMDisableSeekForwardOnChunkMissesCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AdpcmAudioDecoder/Module/Private/ADPCMAudioInfo.cpp:18
Scope: file
Source code excerpt:
ECVF_Default);
static int32 ADPCMDisableSeekForwardOnChunkMissesCVar = 1;
FAutoConsoleVariableRef CVarADPCMDisableSeekForwardOnChunkMisses(
TEXT("au.adpcm.DisableSeekForwardOnReadMisses"),
ADPCMDisableSeekForwardOnChunkMissesCVar,
TEXT("When there is a seek pending and this CVar is set to 0, we will scan forward in the file.\n"),
ECVF_Default);
static int32 ADPCMOnlySeekForwardOneChunkCVar = 1;
FAutoConsoleVariableRef CVarADPCMOnlySeekForwardOneChunk(
TEXT("au.adpcm.OnlySeekForwardOneChunk"),
#Loc: <Workspace>/Engine/Source/Runtime/AdpcmAudioDecoder/Module/Private/ADPCMAudioInfo.cpp:718
Scope (from outer to inner):
file
function bool FADPCMAudioInfo::StreamCompressedData
Source code excerpt:
// If we've already seeked forward one chunk and haven't loaded the next chunk in time and are skipping to the next one, we stop seeking to prevent snowballing chunk load requests.
const bool bAlreadySeekedFowardOneChunk = ADPCMOnlySeekForwardOneChunkCVar && bSeekedFowardToNextChunk;
const bool bShouldSeekForwardOnMissedChunk = !ADPCMDisableSeekForwardOnChunkMissesCVar && !bAlreadySeekedFowardOneChunk && (bSeekPendingRead || CurrentChunkIndex > FirstChunkSampleDataIndex);
if (bShouldSeekForwardOnMissedChunk)
{
const uint32 NumBlocksForCallback = BufferSize / (UncompressedBlockSize * NumChannels);
const uint32 NumCompressedBytesForCallback = NumBlocksForCallback * CompressedBlockSize * NumChannels;