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
)

Add an additional reference for a chunk.

Public function

bool

 

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. Returns false on failure.

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, ...

 

DebugDisplay

(
    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

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
)

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

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
)

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
)

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

Classes

Name

Description

Public struct

FChunkKey

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback