UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FCachedAudioStreamingManager Struct Reference

#include <AudioStreamingCache.h>

+ Inheritance diagram for FCachedAudioStreamingManager:

Public Member Functions

 FCachedAudioStreamingManager (const FCachedAudioStreamingManagerParams &InitParams)
 
virtual ~FCachedAudioStreamingManager ()
 
virtual void UpdateResourceStreaming (float DeltaTime, bool bProcessEverything=false) override
 
virtual int32 BlockTillAllRequestsFinished (float TimeLimit=0.0f, bool bLogResults=false) override
 
virtual void CancelForcedResources () override
 
virtual void NotifyLevelChange () override
 
virtual void SetDisregardWorldResourcesForFrames (int32 NumFrames) override
 
virtual void AddLevel (class ULevel *Level) override
 
virtual void RemoveLevel (class ULevel *Level) override
 
virtual void NotifyLevelOffset (class ULevel *Level, const FVector &Offset) override
 
virtual void AddForceInlineSoundWave (const FSoundWaveProxyPtr &SoundWave) override
 
virtual void RemoveForceInlineSoundWave (const FSoundWaveProxyPtr &SoundWave) override
 
virtual bool RequestChunk (const FSoundWaveProxyPtr &SoundWave, uint32 ChunkIndex, TFunction< void(EAudioChunkLoadResult)> OnLoadCompleted, ENamedThreads::Type ThreadToCallOnLoadCompletedOn, bool bForImmediatePlayback=false) override
 
virtual FAudioChunkHandle GetLoadedChunk (const FSoundWaveProxyPtr &SoundWave, uint32 ChunkIndex, bool bBlockForLoad=false, bool bForImmediatePlayback=false) const override
 
virtual uint64 TrimMemory (uint64 NumBytesToFree) override
 
virtual int32 RenderStatAudioStreaming (UWorld *World, FViewport *Viewport, FCanvas *Canvas, int32 X, int32 Y, const FVector *ViewLocation, const FRotator *ViewRotation) override
 
virtual FString GenerateMemoryReport () override
 
virtual void SetProfilingMode (bool bEnabled) override
 
- Public Member Functions inherited from IStreamingManager
 IStreamingManager ()
 
virtual ~IStreamingManager ()
 
virtual ENGINE_API void Tick (float DeltaTime, bool bProcessEverything=false)
 
virtual ENGINE_API int32 StreamAllResources (float TimeLimit=0.0f)
 
void RemoveStreamingViews (ERemoveStreamingViews RemovalType)
 
ENGINE_API void AddViewInformation (const FVector &ViewOrigin, float ScreenSize, float FOVScreenSize, float BoostFactor=1.0f, bool bOverrideLocation=false, float Duration=0.0f, TWeakObjectPtr< AActor > InActorToBoost=NULL, TWeakObjectPtr< UWorld > InWorld=NULL)
 
ENGINE_API void AddViewLocation (const FVector &Location, float BoostFactor=1.0f, bool bOverrideLocation=false, float Duration=0.0f)
 
virtual bool Exec (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
 
virtual void NotifyActorDestroyed (AActor *Actor)
 
virtual void NotifyPrimitiveDetached (const UPrimitiveComponent *Primitive)
 
virtual void NotifyPrimitiveUpdated (const UPrimitiveComponent *Primitive)
 
virtual void NotifyPrimitiveUpdated_Concurrent (const UPrimitiveComponent *Primitive)
 
int32 GetNumViews () const
 
const FStreamingViewInfoGetViewInformation (int32 ViewIndex) const
 
virtual int32 GetNumWantingResources () const
 
virtual int32 GetNumWantingResourcesID () const
 
virtual void PropagateLightingScenarioChange ()
 

Static Public Member Functions

static int32 GetNextChunkIndex (const FSoundWaveProxyPtr &InSoundWave, const uint32 InCurrentChunkIndex)
 
- Static Public Member Functions inherited from IStreamingManager
static ENGINE_API struct FStreamingManagerCollectionGet ()
 
static ENGINE_API struct FStreamingManagerCollectionGet_Concurrent ()
 
static ENGINE_API void Shutdown ()
 
static ENGINE_API bool HasShutdown ()
 

Protected Member Functions

virtual void AddReferenceToChunk (const FAudioChunkHandle &InHandle) override
 
virtual void RemoveReferenceToChunk (const FAudioChunkHandle &InHandle) override
 
virtual void AddMemoryCountedFeature (const FAudioStreamCacheMemoryHandle &Feature) override
 
virtual void RemoveMemoryCountedFeature (const FAudioStreamCacheMemoryHandle &Feature) override
 
virtual void HandleStarvation (const FSoundWaveProxyPtr &SoundWave, const uint32 ChunkIndex, const uint32 InBytesProduced, const uint32 InBytesExpected) override
 
FAudioChunkCacheGetCacheForWave (const FSoundWaveProxyPtr &InSoundWave) const
 
FAudioChunkCacheGetCacheForChunkSize (uint32 InChunkSize) const
 
- Protected Member Functions inherited from IStreamingManager
void SetupViewInfos (float DeltaTime)
 

Protected Attributes

TArray< FAudioChunkCacheCacheArray
 
- Protected Attributes inherited from IAudioStreamingManager
friend FAudioChunkHandle
 
friend FAudioStreamCacheMemoryHandle
 
- Protected Attributes inherited from IStreamingManager
int32 NumWantingResources
 
int32 NumWantingResourcesCounter
 

Additional Inherited Members

- Static Public Attributes inherited from IAudioStreamingManager
static constexpr auto LoadCompletedDefault = [](EAudioChunkLoadResult) {}
 
- Static Protected Member Functions inherited from IAudioStreamingManager
static FAudioChunkHandle BuildChunkHandle (const uint8 *InData, uint32 NumBytes, const FSoundWaveProxyPtr &InSoundWave, const FName &SoundWaveName, uint32 InChunkIndex, uint64 CacheLookupID)
 
- Static Protected Member Functions inherited from IStreamingManager
static void AddViewInfoToArray (TArray< FStreamingViewInfo > &ViewInfos, const FVector &ViewOrigin, float ScreenSize, float FOVScreenSize, float BoostFactor, bool bOverrideLocation, float Duration, TWeakObjectPtr< AActor > InActorToBoost, TWeakObjectPtr< UWorld > InWorld)
 
static void RemoveViewInfoFromArray (TArray< FStreamingViewInfo > &ViewInfos, const FVector &ViewOrigin)
 
- Static Protected Attributes inherited from IStreamingManager
static ENGINE_API TArray< FStreamingViewInfoCurrentViewInfos
 
static TArray< FStreamingViewInfoPendingViewInfos
 
static TArray< FStreamingViewInfoLastingViewInfos
 
static TArray< FSecondaryLocationSecondaryLocations
 
static bool bPendingRemoveViews = false
 

Detailed Description

This implementation of the audio streaming manager uses an internal LRU cache (or in more advanced applications, a bank of parallel LRU caches)

Constructor & Destructor Documentation

◆ FCachedAudioStreamingManager()

FCachedAudioStreamingManager::FCachedAudioStreamingManager ( const FCachedAudioStreamingManagerParams InitParams)

Constructor, initializing all members

◆ ~FCachedAudioStreamingManager()

FCachedAudioStreamingManager::~FCachedAudioStreamingManager ( )
virtual

Member Function Documentation

◆ AddForceInlineSoundWave()

void FCachedAudioStreamingManager::AddForceInlineSoundWave ( const FSoundWaveProxyPtr SoundWave)
overridevirtual

Adds the memory usage of the force inline sound to the streaming cache budget

Reimplemented from IAudioStreamingManager.

◆ AddLevel()

void FCachedAudioStreamingManager::AddLevel ( class ULevel Level)
overridevirtual

Adds a ULevel that has already prepared StreamingData to the streaming manager.

Implements IStreamingManager.

◆ AddMemoryCountedFeature()

void FCachedAudioStreamingManager::AddMemoryCountedFeature ( const FAudioStreamCacheMemoryHandle Feature)
overrideprotectedvirtual

This can be used to increase the memory count for external features. Called by FAudioStreamCacheMemoryHandle. The pattern for changing the amount of memory of an already added feature is to first remove and then add again with the new number

Reimplemented from IAudioStreamingManager.

◆ AddReferenceToChunk()

void FCachedAudioStreamingManager::AddReferenceToChunk ( const FAudioChunkHandle InHandle)
overrideprotectedvirtual

This can be used to increment reference counted handles to audio chunks. Called by the copy constructor of FAudioChunkHandle.

Implements IAudioStreamingManager.

◆ BlockTillAllRequestsFinished()

int32 FCachedAudioStreamingManager::BlockTillAllRequestsFinished ( float  TimeLimit = 0.0f,
bool  bLogResults = false 
)
overridevirtual

Blocks till all pending requests are fulfilled.

Parameters
TimeLimitOptional time limit for processing, in seconds. Specifying 0 means infinite time limit.
bLogResultsWhether to dump the results to the log.
Returns
Number of streaming requests still in flight, if the time limit was reached before they were finished.

Implements IStreamingManager.

◆ CancelForcedResources()

void FCachedAudioStreamingManager::CancelForcedResources ( )
overridevirtual

Cancels the timed Forced resources (i.e used the Kismet action "Stream In Textures").

Implements IStreamingManager.

◆ GenerateMemoryReport()

FString FCachedAudioStreamingManager::GenerateMemoryReport ( )
overridevirtual

Generate a memory report as a formatted string for this streaming manager.

Implements IAudioStreamingManager.

◆ GetCacheForChunkSize()

FAudioChunkCache * FCachedAudioStreamingManager::GetCacheForChunkSize ( uint32  InChunkSize) const
protected

◆ GetCacheForWave()

FAudioChunkCache * FCachedAudioStreamingManager::GetCacheForWave ( const FSoundWaveProxyPtr InSoundWave) const
protected

Returns which cache this sound wave should be in, based on the size of this sound wave's chunk, or nullptr if MemoryLoadOnDemand is disabled.

◆ GetLoadedChunk()

FAudioChunkHandle FCachedAudioStreamingManager::GetLoadedChunk ( const FSoundWaveProxyPtr SoundWave,
uint32  ChunkIndex,
bool  bBlockForLoad = false,
bool  bForImmediatePlayback = false 
) const
overridevirtual

Gets a pointer to a chunk of audio data

Parameters
SoundWaveSoundWave we want a chunk from
ChunkIndexIndex of the chunk we want
bBlockForLoadif true, will block this thread until we finish loading this chunk.
bForImmediatePlaybackif true, will optionally reprioritize this chunk's load request. See au.streamcaching.PlaybackRequestPriority.
Returns
a handle to the loaded chunk. Can return a default constructed FAudioChunkHandle if the chunk is not loaded yet.

Implements IAudioStreamingManager.

◆ GetNextChunkIndex()

int32 FCachedAudioStreamingManager::GetNextChunkIndex ( const FSoundWaveProxyPtr InSoundWave,
const uint32  InCurrentChunkIndex 
)
static

Returns the next chunk to kick off a load for, or INDEX_NONE if there is only one chunk to cache.

Parameters
InSoundWaveWave Proxy
InCurrentChunkIndexCurrent index to move forwards of
Returns
Chunk Index or INDEX_NONE if there is only one chunk

◆ HandleStarvation()

void FCachedAudioStreamingManager::HandleStarvation ( const FSoundWaveProxyPtr SoundWave,
const uint32  ChunkIndex,
const uint32  InBytesProduced,
const uint32  InBytesExpected 
)
overrideprotectedvirtual

In the event that the decoder playing back the chunks is in a starvation state due to an outstanding chunk load, handle that here.

Reimplemented from IAudioStreamingManager.

◆ NotifyLevelChange()

void FCachedAudioStreamingManager::NotifyLevelChange ( )
overridevirtual

Notifies manager of "level" change.

Implements IStreamingManager.

◆ NotifyLevelOffset()

void FCachedAudioStreamingManager::NotifyLevelOffset ( class ULevel Level,
const FVector Offset 
)
overridevirtual

Notifies manager that level primitives were shifted

Implements IStreamingManager.

◆ RemoveForceInlineSoundWave()

void FCachedAudioStreamingManager::RemoveForceInlineSoundWave ( const FSoundWaveProxyPtr SoundWave)
overridevirtual

Removes the memory usage of the force inline sound from the streaming cache budget

Reimplemented from IAudioStreamingManager.

◆ RemoveLevel()

void FCachedAudioStreamingManager::RemoveLevel ( class ULevel Level)
overridevirtual

Removes a ULevel from the streaming manager.

Implements IStreamingManager.

◆ RemoveMemoryCountedFeature()

void FCachedAudioStreamingManager::RemoveMemoryCountedFeature ( const FAudioStreamCacheMemoryHandle Feature)
overrideprotectedvirtual

This can be used to decrease the memory count for external features. Called by FAudioStreamCacheMemoryHandle.

Reimplemented from IAudioStreamingManager.

◆ RemoveReferenceToChunk()

void FCachedAudioStreamingManager::RemoveReferenceToChunk ( const FAudioChunkHandle InHandle)
overrideprotectedvirtual

This can be used to decrement reference counted handles to audio chunks. Called by the destructor of FAudioChunkHandle.

Implements IAudioStreamingManager.

◆ RenderStatAudioStreaming()

int32 FCachedAudioStreamingManager::RenderStatAudioStreaming ( UWorld World,
FViewport Viewport,
FCanvas Canvas,
int32  X,
int32  Y,
const FVector ViewLocation,
const FRotator ViewRotation 
)
overridevirtual

Used for rendering debug info:

Implements IAudioStreamingManager.

◆ RequestChunk()

bool FCachedAudioStreamingManager::RequestChunk ( const FSoundWaveProxyPtr SoundWave,
uint32  ChunkIndex,
TFunction< void(EAudioChunkLoadResult)>  OnLoadCompleted,
ENamedThreads::Type  ThreadToCallOnLoadCompletedOn,
bool  bForImmediatePlayback = false 
)
overridevirtual

◆ SetDisregardWorldResourcesForFrames()

void FCachedAudioStreamingManager::SetDisregardWorldResourcesForFrames ( int32  NumFrames)
overridevirtual

Don't stream world resources for the next NumFrames.

Implements IStreamingManager.

◆ SetProfilingMode()

void FCachedAudioStreamingManager::SetProfilingMode ( bool  bEnabled)
overridevirtual

Whether to toggle a performance intensive profiling mode the streaming manager.

Implements IAudioStreamingManager.

◆ TrimMemory()

uint64 FCachedAudioStreamingManager::TrimMemory ( uint64  NumBytesToFree)
overridevirtual

This will start evicting elements from the cache until either hit our target of bytes or run out of chunks we can free.

Parameters
NumBytesToFreeThe amount of memory we would like to free, in bytes.
Returns
the amount of bytes we managed to free.

Implements IAudioStreamingManager.

◆ UpdateResourceStreaming()

void FCachedAudioStreamingManager::UpdateResourceStreaming ( float  DeltaTime,
bool  bProcessEverything = false 
)
overridevirtual

Updates streaming, taking into account all current view infos. Can be called multiple times per frame.

Parameters
DeltaTimeTime since last call in seconds
bProcessEverything[opt] If true, process all resources with no throttling limits

Implements IStreamingManager.

Member Data Documentation

◆ CacheArray

TArray<FAudioChunkCache> FCachedAudioStreamingManager::CacheArray
protected

Audio chunk caches. These are set up on initialization.


The documentation for this struct was generated from the following files: