UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AudioStreamingCache.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4AudioStreaming.h: Definitions of classes used for audio streaming.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
12#include "Containers/Queue.h"
13#include "Stats/Stats.h"
14#include "ContentStreaming.h"
15#include "Async/AsyncWork.h"
17#include "HAL/ThreadSafeBool.h"
18#include "AudioStreaming.h"
19#include "Sound/SoundWave.h"
21#include "Templates/DontCopy.h"
22#include "Templates/UniqueObj.h"
23#include "UObject/ObjectKey.h"
24
25
26#define DEBUG_STREAM_CACHE !UE_BUILD_SHIPPING
27
29
31
32// Basic fixed-size LRU cache for retaining chunks of compressed audio data.
34{
35public:
36 struct FChunkKey
37 {
38 public:
39 FChunkKey() = default;
40
41 FChunkKey(const FChunkKey& Other) = default;
42
45 , const FGuid& InSoundWaveGuid
49#endif // #if WITH_EDITOR
50 );
51
57#endif // #if WITH_EDITOR
58 );
59
60 FChunkKey& operator=(const FChunkKey& Other) = default;
61
62
63 public:
67
68#if WITH_EDITOR
69 // This is used in the editor to invalidate stale compressed chunks.
71#endif
72 bool operator==(const FChunkKey& Other) const;
73
76 {
77 // We can use HashCombineFast since we're hashing FName and they won't give the same result across different engine restart anyway.
79#if WITH_EDITOR
80 Hash = HashCombineFast(Hash, InChunkKey.ChunkRevision);
81#endif
82 return Hash;
83 }
84 };
85
87 {
88 public:
89 // ctor
94
95 inline bool operator==(const FCacheMissEntry& Other) const
96 {
97 return (SoundWaveName == Other.SoundWaveName) && (ChunkIndex == Other.ChunkIndex);
98 }
99
101
103
106 {
107 // We can use HashCombineFast since we're hashing FName and they won't give the same result across different engine restart anyway.
108 return HashCombineFast(GetTypeHash(InCacheMissEntry.SoundWaveName), InCacheMissEntry.ChunkIndex);
109 }
110 };
111
114
115 // Places chunk in cache, or puts this chunk back at the top of the cache if it's already loaded. Returns the static lookup ID of the chunk in the cache on success,
116 // or InvalidAudioStreamCacheLookupID on failiure.
118
119 // Returns the chunk asked for, or an empty TArrayView if that chunk is not loaded.
120 // InOutCacheLookupID can optionally be set as a cache offset to use directly rather than searching the cache for a matching chunk.
121 // InOutCacheLookupID will be set to the offset the chunk is in the cache, which can be used for faster lookup in the future.
123
124 // add an additional reference for a chunk.
125 void AddNewReferenceToChunk(const FChunkKey& InKey);
126 void RemoveReferenceToChunk(const FChunkKey& InKey);
127
128 // Evict all sounds from the cache. Does not account for force inline sounds
129 void ClearCache();
130
132
134
136
138
139 // This function will reclaim memory by freeing as many chunks as needed to free BytesToFree.
140 // returns the amount of bytes we were actually able to free.
141 // It's important to note that this will block any chunk requests.
143
144 // Returns an array of the USoundwaves retaining the least recently used retained chunks in the cache.
145 // This can potentially return soundwaves for chunks that are retained by a currently playing sound, if the cache is thrashed enough.
147
148 // This function will continue to lock until any async file loads are finished.
149 void BlockForAllPendingLoads() const;
150
151 // This function will cancel any in-flight loads and wait for their completion.
153
154 // Reports the size of this cache's memory pool, in bytes.
156
157 // Debug tools:
158 // Call this to start enqueing reports on any cache misses to a queue.
159 // This queue will continue to grow until FlushCacheMissLog is called.
161
162 // This will stop enqueueing reports of cache misses.
164
165 // When called, flushes the entire queue of cache misses that has accumulated
166 // And prints them to a formatted
167 FString FlushCacheMissLog();
168
169 // Static helper function to make sure a chunk is withing the bounds of a USoundWave.
171
172 // interface with the cache id lookup map
175
177
178 // This is for debugging purposes only. Prints the elements in the cache from most recently used to least.
179 // Returns the dimensions of this debug log so that multiple caches can be tiled across the screen.
180 TPair<int, int> DebugDisplayLegacy(UWorld* World, FViewport* Viewport, FCanvas* Canvas, int32 X, int32 Y, const FVector* ViewLocation, const FRotator* ViewRotation) const;
181
182 // Generate a formatted text file for this cache.
183 FString DebugPrint();
184
185 // This is for debugging purposes only. Prints the elements in the cache from most recently used to least.
186 // Returns the dimensions of this debug log so that multiple caches can be tiled across the screen.
187
205
206 TPair<int, int> DebugDisplay(UWorld* World, FViewport* Viewport, FCanvas* Canvas, int32 X, int32 Y, const FVector* ViewLocation, const FRotator* ViewRotation) const;
207 TPair<int, int> DebugVisualDisplay(UWorld* World, FViewport* Viewport, FCanvas* Canvas, int32 X, int32 Y, const FVector* ViewLocation, const FRotator* ViewRotation) const;
208 TPair<int, int> DebugBirdsEyeDisplay(UWorld* World, FViewport* Viewport, FCanvas* Canvas, int32 X, int32 Y, const FVector* ViewLocation, const FRotator* ViewRotation) const;
209
211
213 {
214 CacheOverflowCount.Increment();
215 }
216
218 {
219 return CacheOverflowCount.GetValue();
220 }
221
222private:
223
224#if DEBUG_STREAM_CACHE
225 // This struct lets us breadcrumb debug information.
226 struct FCacheElementDebugInfo
227 {
228 // The total number of chunks in the sound wave.
229 int32 NumTotalChunks;
230
231 // Number of times this chunk was requested during its time in the cache.
232 int32 NumTimesTouched;
233
234 uint64 TimeLoadStartedCycles = 0;
235 uint64 TimeLoadEndedCycles = 0;
236 // Amount of time spent loading the audio file.
237 float TimeToLoadMs;
238
239 // This is a cumulative moving average of a chunks location before it was
240 float AverageLocationInCacheWhenNeeded;
241
242 // Note the loading behavior of the sound wave that inserted this element into the cache
243 ESoundWaveLoadingBehavior LoadingBehavior;
244 bool bLoadingBehaviorExternallyOverriden;
245
246 // cached format.
248 float OffsetInSeconds=0.f;
249
250 // if true,
251 bool bWasCacheMiss;
252 bool bWasLoadedFromInlineChunk = false;
253 bool bWasInlinedButUnloaded = false;
254 bool bWaveDestroyed = false;
255
256 FCacheElementDebugInfo()
257 : NumTotalChunks(0)
258 , NumTimesTouched(0)
259 , TimeLoadStartedCycles(0)
260 , TimeToLoadMs(0.0)
261 , AverageLocationInCacheWhenNeeded(0.0f)
262 , LoadingBehavior(ESoundWaveLoadingBehavior::Uninitialized)
263 , bWasCacheMiss(false)
264 {
265 }
266
267 void Reset()
268 {
269 TimeLoadEndedCycles = 0;
270 NumTotalChunks = 0;
271 NumTimesTouched = 0;
272 TimeLoadStartedCycles = 0;
273 TimeToLoadMs = 0.0f;
275 bWasCacheMiss = false;
276 AverageLocationInCacheWhenNeeded = 0.0f;
277 bWasLoadedFromInlineChunk = false;
278 bWasInlinedButUnloaded = false;
279 bWaveDestroyed = false;
280 Format = {};
281 }
282
283 };
284#endif
285
286
287 // counter for the number of times this cache has overflown
288 FThreadSafeCounter CacheOverflowCount;
289
290
291 // Struct containing a single element in our LRU Cache.
292 struct FCacheElement
293 {
294 FChunkKey Key;
296 uint32 ChunkDataSize;
297 FCacheElement* MoreRecentElement;
298 FCacheElement* LessRecentElement;
300
302
303 FThreadSafeBool bIsLoaded;
304
305#if !UE_BUILD_SHIPPING
306 // if the chunk belongs to a sound that wants more logging. This should be under LogAudio so its'
307 // with the other extra logging.
308 bool bWantsExtraLogging = false;
309#endif
310 bool WantsFilteredLogging() const
311 {
312#if !UE_BUILD_SHIPPING
313 return bWantsExtraLogging;
314#else
315 return false;
316#endif
317 }
318
319 // How many disparate consumers have called GetLoadedChunk.
320 FThreadSafeCounter NumConsumers;
321
322#if WITH_EDITORONLY_DATA
324#endif
325
328
329#if DEBUG_STREAM_CACHE
330 FCacheElementDebugInfo DebugInfo;
331#endif
332
333 FCacheElement(uint32 InCacheIndex)
334 : ChunkData(nullptr)
335 , ChunkDataSize(0)
336 , MoreRecentElement(nullptr)
337 , LessRecentElement(nullptr)
338 , CacheLookupID(InCacheIndex)
339 , bIsLoaded(false)
340 {
341 }
342
343 void WaitForAsyncLoadCompletion(bool bCancel);
344
345 bool IsLoadInProgress() const
346 {
347 return !bIsLoaded;
348 }
349
350 bool IsInUse() const
351 {
352 return NumConsumers.GetValue() > 0;
353 }
354
355#if DEBUG_STREAM_CACHE
356 bool IsBeingPlayed() const;
357 void UpdateDebugInfoLoadingBehavior();
358#endif
359
360 bool CanEvictChunk() const
361 {
362 return !IsInUse() && !IsLoadInProgress();
363 }
364
365 uint32 GetNumChunks() const;
366 FStreamedAudioChunk* GetChunk(uint32 InChunkIndex) const;
367
368#if WITH_EDITOR
369 bool IsChunkStale();
370#endif
371 void ReleaseRetainedAudioOnSoundWave();
372 bool IsSoundWaveRetainingAudio() const;
373
374 ~FCacheElement()
375 {
376 WaitForAsyncLoadCompletion(true);
377
378 if(NumConsumers.GetValue() != 0)
379 {
385 }
386 else if (ChunkData)
387 {
388 FMemory::Free(ChunkData);
389 ChunkData = nullptr;
390 }
391
392 }
393 };
394
395 // Our actual memory pool.
396 TArray<FCacheElement> CachePool;
397 FCacheElement* MostRecentElement;
398 FCacheElement* LeastRecentElement;
399
400 // This is incremented on every call of InsertChunk until we hit CachePool.Num() or MemoryCounterBytes hits MemoryLimitBytes.
401 int32 ChunksInUse;
402
403 // This counter is used to start evicting chunks before we hit CachePool.Num().
404 TUniqueObj<TAtomic<uint64>> MemoryCounterBytes;
405 uint64 MemoryLimitBytes;
406
407 TUniqueObj<TAtomic<uint64>> ForceInlineMemoryCounterBytes;
408
409 TUniqueObj<TAtomic<uint64>> FeatureMemoryCounterBytes;
410
411 // Number of async load operations we have currently in flight.
412 FThreadSafeCounter NumberOfLoadsInFlight;
413
414 // Time begin play came in. (so we can validate load times against load screen/vs level loads).
415 uint64 TimeOfBeginPlayCycles=0;
416
417 // Critical section: only used when we are modifying element positions in the cache. This only happens in TouchElement, EvictLeastRecentChunk, and TrimMemory.
418 // Individual cache elements should be thread safe to access.
419 mutable TDontCopy<FCriticalSection> CacheMutationCriticalSection;
420
421 // Map that USoundWaves, FSoundWaveProxys, FChunkKeys, and FAudioChunkHandles can use to
422 // quickly lookup where their chunks are currently stored in the cache
423 TMap<FChunkKey, uint64> CacheLookupIdMap;
424
425 struct FSoundWaveMemoryTracker
426 {
427 int32 RefCount = 0;
428 int64 MemoryCount = 0;
429 };
430 // A map to look up the number of times a sound wave has been added for memory tracking
431 // as well as the memory added for the "latest" addition
433 TDontCopy<FCriticalSection> SoundWaveMemoryTrackerCritSec;
434
435 // This struct is used for logging cache misses.
436 struct FCacheMissInfo
437 {
438 FName SoundWaveName;
439 uint32 ChunkIndex;
440 uint32 TotalChunksInWave;
441 bool bBlockedForLoad;
442 };
443
444 // This queue is pushed to anytime GetChunk fails to get the chunk. and bLogCacheMisses is true.
445 TUniqueObj<TQueue<FCacheMissInfo>> CacheMissQueue;
446
447 // This is set to true when BeginLoggingCacheMisses is called.
448 bool bLogCacheMisses;
449
450 uint64 GetCurrentMemoryUsageBytes() const { return *MemoryCounterBytes + *ForceInlineMemoryCounterBytes + *FeatureMemoryCounterBytes; }
451
452 // Returns cached element if it exists in our cache, nullptr otherwise.
453 // If the index of the element is already known, it can be used here to avoid searching the cache.
454 FCacheElement* FindElementForKey(const FChunkKey& InKey);
455 FCacheElement* LinearSearchCacheForElement(const FChunkKey& InKey);
456 FCacheElement* LinearSearchChunkArrayForElement(const FChunkKey& InKey);
457
458 // Puts this element at the front of the linked list.
459 void TouchElement(FCacheElement* InElement);
460
461 // Inserts a new element into the cache, potentially evicting the oldest element in the cache.
462 FCacheElement* InsertChunk(const FChunkKey& InKey, const TSharedPtr<FSoundWaveData>& InSoundWaveWeakPtr);
463
464 // This is called once we have more than one chunk in our cache:
465 void SetUpLeastRecentChunk();
466
467 // This is called in InsertChunk. it determines whether we should add a new chunk at the tail of the linked list or
468 // evict the least recent chunk.
469 bool ShouldAddNewChunk() const;
470
471 // Returns the least recent chunk and fixes up the linked list accordingly.
472 FCacheElement* EvictLeastRecentChunk(bool bBlockForPendingLoads = false);
473
474
475 void KickOffAsyncLoad(FCacheElement* CacheElement, const FChunkKey& InKey, TFunction<void(EAudioChunkLoadResult)> OnLoadCompleted, ENamedThreads::Type CallbackThread, bool bNeededForPlayback);
476 EAsyncIOPriorityAndFlags GetAsyncPriorityForChunk(const FChunkKey& InKey, bool bNeededForPlayback);
477
478 // Calls OnLoadCompleted on current thread if CallbackThread == ENamedThreads::AnyThread, and dispatchs an async task on a named thread otherwise.
479 static void ExecuteOnLoadCompleteCallback(EAudioChunkLoadResult Result, const TFunction<void(EAudioChunkLoadResult)>& OnLoadCompleted, const ENamedThreads::Type& CallbackThread);
480};
481
482// This is used to sort the cache array from smallest chunk size to biggest.
484{
485 return Element1.MaxChunkSize < Element2.MaxChunkSize;
486}
487
489{
491 {
492 // The max size, in bytes, of a single chunk of compressed audio.
493 // During cook, compressed audio assets will be chunked based on this amount.
495
496 // The maximum number of elements stored in a single cache before it is evicted.
497 // At runtime, this will be clamped to ensure that it is greater than the amount of
498 // sources that can be playing simultaneously.
500
501 // The maximum number of elements stored in a single cache before it is evicted.
502 // At runtime, this will be clamped to ensure that it is greater than the amount of
503 // sources that can be playing simultaneously.
505 };
506
507 // Most use cases will only use a single cache, but applications can optionally
508 // use multiple LRU caches to reduce churn for specific types of sounds.
509 // For example, an application can have
510 // a cache for short sounds with room for many elements, and a separate cache
511 // for longer sounds with fewer elements.
513};
514
519{
520public:
523
525
526 // IStreamingManager interface
527 virtual void UpdateResourceStreaming( float DeltaTime, bool bProcessEverything=false ) override;
528 virtual int32 BlockTillAllRequestsFinished( float TimeLimit = 0.0f, bool bLogResults = false ) override;
529 virtual void CancelForcedResources() override;
530 virtual void NotifyLevelChange() override;
531 virtual void SetDisregardWorldResourcesForFrames( int32 NumFrames ) override;
532 virtual void AddLevel( class ULevel* Level ) override;
533 virtual void RemoveLevel( class ULevel* Level ) override;
534 virtual void NotifyLevelOffset( class ULevel* Level, const FVector& Offset ) override;
535 // End IStreamingManager interface
536
537 // IAudioStreamingManager interface
538 virtual void AddForceInlineSoundWave(const FSoundWaveProxyPtr& SoundWave) override;
539 virtual void RemoveForceInlineSoundWave(const FSoundWaveProxyPtr& SoundWave) override;
541 virtual FAudioChunkHandle GetLoadedChunk(const FSoundWaveProxyPtr& SoundWave, uint32 ChunkIndex, bool bBlockForLoad = false, bool bForImmediatePlayback = false) const override;
542 virtual uint64 TrimMemory(uint64 NumBytesToFree) override;
543 virtual int32 RenderStatAudioStreaming(UWorld* World, FViewport* Viewport, FCanvas* Canvas, int32 X, int32 Y, const FVector* ViewLocation, const FRotator* ViewRotation) override;
544 virtual FString GenerateMemoryReport() override;
545 virtual void SetProfilingMode(bool bEnabled) override;
546 // End IAudioStreamingManager interface
547
555
556protected:
557
558 // These are used to reference count consumers of audio chunks.
559 virtual void AddReferenceToChunk(const FAudioChunkHandle& InHandle) override;
560 virtual void RemoveReferenceToChunk(const FAudioChunkHandle& InHandle) override;
561
562 // These are used to update the memory count of Memory Counted Features
565
566 virtual void HandleStarvation(const FSoundWaveProxyPtr& SoundWave, const uint32 ChunkIndex, const uint32 InBytesProduced, const uint32 InBytesExpected) override;
567
575
578};
bool operator<(const FAudioChunkCache &Element1, const FAudioChunkCache &Element2)
Definition AudioStreamingCache.h:483
#define WITH_EDITOR
Definition Build.h:67
EAudioChunkLoadResult
Definition ContentStreaming.h:505
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
DIRECTLINK_API Display
Definition DirectLinkLog.h:8
#define X(Name, Desc)
Definition FormatStringSan.h:47
EAsyncIOPriorityAndFlags
Definition GenericPlatformFile.h:31
@ AIOP_MIN
Definition GenericPlatformFile.h:41
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
ESoundWaveLoadingBehavior
Definition SoundWaveLoadingBehavior.h:24
constexpr uint64 InvalidAudioStreamCacheLookupID
Definition SoundWave.h:87
constexpr uint32 HashCombineFast(uint32 A, uint32 B)
Definition TypeHash.h:74
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition AudioStreamingCache.h:34
void RemoveMemoryCountedFeature(const FAudioStreamCacheMemoryHandle &Feature)
Definition AudioStreamingCache.cpp:1215
const int32 MaxChunkSize
Definition AudioStreamingCache.h:176
void CancelAllPendingLoads()
Definition AudioStreamingCache.cpp:1355
TPair< int, int > DebugDisplay(UWorld *World, FViewport *Viewport, FCanvas *Canvas, int32 X, int32 Y, const FVector *ViewLocation, const FRotator *ViewRotation) const
Definition AudioStreamingCache.cpp:2626
void ClearCache()
Definition AudioStreamingCache.cpp:1083
TPair< int, int > DebugDisplayLegacy(UWorld *World, FViewport *Viewport, FCanvas *Canvas, int32 X, int32 Y, const FVector *ViewLocation, const FRotator *ViewRotation) const
Definition AudioStreamingCache.cpp:2235
uint64 AddOrTouchChunk(const FChunkKey &InKey, const TSharedPtr< FSoundWaveData > &InSoundWavePtr, TFunction< void(EAudioChunkLoadResult) > OnLoadCompleted, ENamedThreads::Type CallbackThread, bool bNeededForPlayback)
Definition AudioStreamingCache.cpp:828
void AddNewReferenceToChunk(const FChunkKey &InKey)
Definition AudioStreamingCache.cpp:1059
void SetCacheLookupIDForChunk(const FChunkKey &InChunkKey, uint64 InCacheLookupID)
Definition AudioStreamingCache.cpp:2110
uint64 GetCacheLookupIDForChunk(const FChunkKey &InChunkKey) const
Definition AudioStreamingCache.cpp:2095
TArrayView< uint8 > GetChunk(const FChunkKey &InKey, const TSharedPtr< FSoundWaveData > &InSoundWavePtr, bool bBlockForLoadCompletion, bool bNeededForPlayback, uint64 &InOutCacheLookupID)
Definition AudioStreamingCache.cpp:935
void AddMemoryCountedFeature(const FAudioStreamCacheMemoryHandle &Feature)
Definition AudioStreamingCache.cpp:1193
void BlockForAllPendingLoads() const
Definition AudioStreamingCache.cpp:1324
void BeginLoggingCacheMisses()
Definition AudioStreamingCache.cpp:1383
FString FlushCacheMissLog()
Definition AudioStreamingCache.cpp:1393
TPair< int, int > DebugVisualDisplay(UWorld *World, FViewport *Viewport, FCanvas *Canvas, int32 X, int32 Y, const FVector *ViewLocation, const FRotator *ViewRotation) const
Definition AudioStreamingCache.cpp:3002
void StopLoggingCacheMisses()
Definition AudioStreamingCache.cpp:1388
static bool DoesKeyContainValidChunkIndex(const FChunkKey &InKey, const FSoundWaveData &InSoundWaveData)
Definition AudioStreamingCache.cpp:2090
~FAudioChunkCache()
Definition AudioStreamingCache.cpp:820
EDebugDisplayElementTypes
Definition AudioStreamingCache.h:189
void RemoveForceInlineSoundWave(const FSoundWaveProxyPtr &)
Definition AudioStreamingCache.cpp:1157
void HandleStarvation(const FSoundWaveProxyPtr &SoundWave, const uint32 ChunkIndex, const uint32 InBytesProduced, const uint32 InBytesExpected)
Definition AudioStreamingCache.cpp:2118
uint64 TrimMemory(uint64 BytesToFree, bool bAllowRetainedChunkTrimming)
Definition AudioStreamingCache.cpp:1223
TArray< FObjectKey > GetLeastRecentlyUsedRetainedSoundWaves(int32 NumSoundWavesToRetrieve)
uint64 ReportCacheSize()
Definition AudioStreamingCache.cpp:1376
void IncrementCacheOverflowCounter()
Definition AudioStreamingCache.h:212
int32 GetNumberOfCacheOverflows() const
Definition AudioStreamingCache.h:217
TPair< int, int > DebugBirdsEyeDisplay(UWorld *World, FViewport *Viewport, FCanvas *Canvas, int32 X, int32 Y, const FVector *ViewLocation, const FRotator *ViewRotation) const
Definition AudioStreamingCache.cpp:3115
FString DebugPrint()
Definition AudioStreamingCache.cpp:2473
void RemoveReferenceToChunk(const FChunkKey &InKey)
Definition AudioStreamingCache.cpp:1071
void AddForceInlineSoundWave(const FSoundWaveProxyPtr &)
Definition AudioStreamingCache.cpp:1103
Definition ContentStreaming.h:110
Definition AudioStreamCacheMemoryHandle.h:21
Definition BulkData.h:1295
Definition CanvasTypes.h:211
Definition NameTypes.h:617
Definition SoundWave.h:1571
Definition ThreadSafeBool.h:17
Definition ThreadSafeCounter.h:14
int32 Increment()
Definition ThreadSafeCounter.h:52
int32 GetValue() const
Definition ThreadSafeCounter.h:120
Definition UnrealClient.h:412
Definition ArrayView.h:139
Definition Array.h:670
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition UniqueObj.h:13
Definition UniquePtr.h:107
Definition SharedPointer.h:1295
Definition Level.h:423
Definition World.h:918
constexpr uint32 Read
Definition MassProcessorDependencySolver.h:21
Type
Definition TaskGraphInterfaces.h:57
@ false
Definition radaudio_common.h:23
Definition AudioStreamingCache.h:87
uint32 ChunkIndex
Definition AudioStreamingCache.h:102
bool operator==(const FCacheMissEntry &Other) const
Definition AudioStreamingCache.h:95
FName SoundWaveName
Definition AudioStreamingCache.h:100
friend uint32 GetTypeHash(const FCacheMissEntry &InCacheMissEntry)
Definition AudioStreamingCache.h:105
FCacheMissEntry(FName InSoundWaveName, uint32 InChunkIndex)
Definition AudioStreamingCache.h:90
Definition AudioStreamingCache.h:37
FGuid ObjectKey
Definition AudioStreamingCache.h:65
FChunkKey(const FChunkKey &Other)=default
uint32 ChunkIndex
Definition AudioStreamingCache.h:66
friend uint32 GetTypeHash(const FChunkKey &InChunkKey)
Definition AudioStreamingCache.h:75
FName SoundWaveName
Definition AudioStreamingCache.h:64
bool operator==(const FChunkKey &Other) const
Definition AudioStreamingCache.cpp:336
FChunkKey & operator=(const FChunkKey &Other)=default
Definition AudioStreamingCache.h:491
int32 MaxChunkSize
Definition AudioStreamingCache.h:494
int32 NumElements
Definition AudioStreamingCache.h:499
uint64 MaxMemoryInBytes
Definition AudioStreamingCache.h:504
Definition AudioStreamingCache.h:489
TArray< FCacheDimensions > Caches
Definition AudioStreamingCache.h:512
Definition AudioStreamingCache.h:519
virtual void CancelForcedResources() override
Definition AudioStreamingCache.cpp:505
virtual void AddReferenceToChunk(const FAudioChunkHandle &InHandle) override
Definition AudioStreamingCache.cpp:729
static int32 GetNextChunkIndex(const FSoundWaveProxyPtr &InSoundWave, const uint32 InCurrentChunkIndex)
Definition AudioStreamingCache.cpp:698
virtual void RemoveForceInlineSoundWave(const FSoundWaveProxyPtr &SoundWave) override
Definition AudioStreamingCache.cpp:544
FAudioChunkCache * GetCacheForWave(const FSoundWaveProxyPtr &InSoundWave) const
Definition AudioStreamingCache.cpp:662
virtual uint64 TrimMemory(uint64 NumBytesToFree) override
Definition AudioStreamingCache.cpp:2204
virtual FString GenerateMemoryReport() override
Definition AudioStreamingCache.cpp:2175
virtual void RemoveLevel(class ULevel *Level) override
Definition AudioStreamingCache.cpp:525
virtual void SetProfilingMode(bool bEnabled) override
Definition AudioStreamingCache.cpp:2186
virtual int32 RenderStatAudioStreaming(UWorld *World, FViewport *Viewport, FCanvas *Canvas, int32 X, int32 Y, const FVector *ViewLocation, const FRotator *ViewRotation) override
Definition AudioStreamingCache.cpp:2152
virtual FAudioChunkHandle GetLoadedChunk(const FSoundWaveProxyPtr &SoundWave, uint32 ChunkIndex, bool bBlockForLoad=false, bool bForImmediatePlayback=false) const override
Definition AudioStreamingCache.cpp:580
virtual void RemoveMemoryCountedFeature(const FAudioStreamCacheMemoryHandle &Feature) override
Definition AudioStreamingCache.cpp:562
virtual bool RequestChunk(const FSoundWaveProxyPtr &SoundWave, uint32 ChunkIndex, TFunction< void(EAudioChunkLoadResult)> OnLoadCompleted, ENamedThreads::Type ThreadToCallOnLoadCompletedOn, bool bForImmediatePlayback=false) override
Definition AudioStreamingCache.cpp:765
TArray< FAudioChunkCache > CacheArray
Definition AudioStreamingCache.h:577
virtual int32 BlockTillAllRequestsFinished(float TimeLimit=0.0f, bool bLogResults=false) override
Definition AudioStreamingCache.cpp:492
virtual void AddMemoryCountedFeature(const FAudioStreamCacheMemoryHandle &Feature) override
Definition AudioStreamingCache.cpp:553
virtual void SetDisregardWorldResourcesForFrames(int32 NumFrames) override
Definition AudioStreamingCache.cpp:515
virtual ~FCachedAudioStreamingManager()
Definition AudioStreamingCache.cpp:483
virtual void UpdateResourceStreaming(float DeltaTime, bool bProcessEverything=false) override
Definition AudioStreamingCache.cpp:487
virtual void AddForceInlineSoundWave(const FSoundWaveProxyPtr &SoundWave) override
Definition AudioStreamingCache.cpp:535
virtual void NotifyLevelChange() override
Definition AudioStreamingCache.cpp:510
virtual void HandleStarvation(const FSoundWaveProxyPtr &SoundWave, const uint32 ChunkIndex, const uint32 InBytesProduced, const uint32 InBytesExpected) override
Definition AudioStreamingCache.cpp:571
FAudioChunkCache * GetCacheForChunkSize(uint32 InChunkSize) const
Definition AudioStreamingCache.cpp:678
virtual void AddLevel(class ULevel *Level) override
Definition AudioStreamingCache.cpp:520
virtual void NotifyLevelOffset(class ULevel *Level, const FVector &Offset) override
Definition AudioStreamingCache.cpp:530
virtual void RemoveReferenceToChunk(const FAudioChunkHandle &InHandle) override
Definition AudioStreamingCache.cpp:747
Definition Guid.h:109
static FORCENOINLINE CORE_API void Free(void *Original)
Definition UnrealMemory.cpp:685
Definition SoundWave.h:93
Definition ContentStreaming.h:517
Definition DontCopy.h:13
Definition Tuple.h:652