FAudioChunkCache

Basic fixed-size LRU cache for retaining chunks of compressed audio data.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/AudioStreamingCache.h

Include

#include "AudioStreamingCache.h"

Syntax

class FAudioChunkCache

Remarks

Basic fixed-size LRU cache for retaining chunks of compressed audio data.

Variables

Name Description

Public variable

const int32

 

MaxChunkSize

Constructors

Name Description

Public function

FAudioChunkCache

(
    uint32 InMaxChunkSize,
    uint32 NumChunks,
    uint64 InMemoryLimitInBytes
)

Destructors

Name Description

Public function

~FAudioChunkCache()

Functions

Name Description

Public function

void

 

AddNewReferenceToChunk

(
    const FChunkKey& InKey,
    uint64 InCacheLookupID
)

Add an additional reference for a chunk.

Public function

uint64

 

AddOrTouchChunk

(
    const FChunkKey& InKey,
    TFunction< void...,
    ENamedThreads::Type CallbackThread,
    bool bNeededForPlayback
)

Places chunk in cache, or puts this chunk back at the top of the cache if it's already loaded.

Public function

void

 

BeginLoggingCacheMisses()

Debug tools: Call this to start enqueing reports on any cache misses to a queue.

Public function Const

void

 

BlockForAllPendingLoads()

This function will continue to lock until any async file loads are finished.

Public function

void

 

CancelAllPendingLoads()

This function will cancel any in-flight loads and wait for their completion.

Public function

void

 

ClearCache()

Evict all sounds from the cache.

Public function Const

TPair< int, ...

 

DebugBirdsEyeDisplay

(
    UWorld* World,
    FViewport* Viewport,
    FCanvas* Canvas,
    int32 X,
    int32 Y,
    const FVector* ViewLocation,
    const FRotator* ViewRotation
)

Public function Const

TPair< int, ...

 

DebugDisplay

(
    UWorld* World,
    FViewport* Viewport,
    FCanvas* Canvas,
    int32 X,
    int32 Y,
    const FVector* ViewLocation,
    const FRotator* ViewRotation
)

Public function Const

TPair< int, ...

 

DebugDisplayLegacy

(
    UWorld* World,
    FViewport* Viewport,
    FCanvas* Canvas,
    int32 X,
    int32 Y,
    const FVector* ViewLocation,
    const FRotator* ViewRotation
)

This is for debugging purposes only.

Public function

FString

 

DebugPrint()

Generate a formatted text file for this cache.

Public function Const

TPair< int, ...

 

DebugVisualDisplay

(
    UWorld* World,
    FViewport* Viewport,
    FCanvas* Canvas,
    int32 X,
    int32 Y,
    const FVector* ViewLocation,
    const FRotator* ViewRotation
)

Public function

FString

 

FlushCacheMissLog()

When called, flushes the entire queue of cache misses that has accumulated And prints them to a formatted

Public function

TArrayView< ...

 

GetChunk

(
    const FChunkKey& InKey,
    bool bBlockForLoadCompletion,
    bool bNeededForPlayback,
    uint64& InOutCacheLookupID
)

Returns the chunk asked for, or an empty TArrayView if that chunk is not loaded.

Public function

TArray< FObj...

 

GetLeastRecentlyUsedRetainedSoundWaves

(
    int32 NumSoundWavesToRetrieve
)

Returns an array of the USoundwaves retaining the least recently used retained chunks in the cache.

Public function Const

int32

 

GetNumberOfCacheOverflows()

Public function

void

 

IncrementCacheOverflowCounter()

Public function Static

bool

 

IsKeyValid

(
    const FChunkKey& InKey
)

Static helper function to make sure a chunk is withing the bounds of a USoundWave.

Public function

void

 

RemoveReferenceToChunk

(
    const FChunkKey& InKey,
    uint64 InCacheLookupID
)

Public function

uint64

 

ReportCacheSize()

Reports the size of this cache's memory pool, in bytes.

Public function

void

 

StopLoggingCacheMisses()

This will stop enqueueing reports of cache misses.

Public function

uint64

 

TrimMemory

(
    uint64 BytesToFree,
    bool bAllowRetainedChunkTrimming
)

This function will reclaim memory by freeing as many chunks as needed to free BytesToFree.

Classes

Name

Description

Public struct

FChunkKey

Enums

Name

Description

Public enum

EDebugDisplayElementTypes

This is for debugging purposes only.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss