UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AudioCompressionSettings.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3#include "Containers/Map.h"
5#include "CoreMinimal.h"
6#include "CoreTypes.h"
8#include "Templates/Tuple.h"
10
11#include "AudioCompressionSettings.generated.h"
12
13UENUM()
15{
16 Max,
17 High,
18 Medium,
19 Low,
20 Min
21};
22
23/************************************************************************/
24/* FAudioStreamCachingSettings */
25/* Properties used to determine chunk sizes for the two caches used */
26/* when the experimental Stream Caching feature is used. */
27/************************************************************************/
29{
30 static constexpr int32 DefaultCacheSize = 64 * 1024;
31
32 // Target memory usage, in kilobytes.
33 // In the future settings for the cache can be more complex, but for now
34 // we set the max chunk size to 256 kilobytes, then set the number of elements in our cache as
35 // CacheSizeKB / 256.
37
38 // Bool flag for keeping sounds flagged for streaming chunked in the style of the legacy streaming manager.
40
42
43 // will be ignored if < 0
45
53};
54
55/************************************************************************/
56/* FPlatformAudioCookOverrides */
57/* This struct is used for settings used during the cook to a target */
58/* platform (platform-specific compression quality and resampling, etc.)*/
59/************************************************************************/
61{
62 // Increment this return value to force a recook on all Stream Caching assets.
63 // For testing, it's useful to set this to either a negative number or
64 // absurdly large number, to ensure you do not pollute the DDC.
66
68
69 // Mapping of which sample rates are used for each sample rate quality for a specific platform.
71
72 // Scales all compression qualities when cooking to this platform. For example, 0.5 will halve all compression qualities, and 1.0 will leave them unchanged.
74
75 // If set, the cooker will keep only this level of quality
77
78 // When set to any platform > 0.0, this will automatically set any USoundWave beyond this value to be streamed from disk.
79 // If StreamCaching is set to true, this will be used
81
82 // Wether to inline the first "Audio" chunk, which is typically chunk 1. (Only on assets marked retain-on-load with a size of audio in secs set)
84
85 // This will decide how much data to put in the first audio chunk. Anything <= 0 will be ignored.
86 // Must be combined with bInlineFirstAudioChunk, this will decide how much data to put in the first chunk.
87 // NOTE: This is platform default and can be overriden by each asset or soundclass.
89
90 // If Load On Demand is enabled, these settings are used to determine chunks and cache sizes.
92
106
107 // This is used to invalidate compressed audio for a specific platform.
109};
110
111USTRUCT()
113{
115
116 // When true, overrides the Sound Group on each Sound Wave, and instead uses the Duration Threshold value to determine whether a sound should be fully decompressed during initial loading.
117 UPROPERTY(EditAnywhere, Category = "DecompressOnLoad")
118 bool bOverrideCompressionTimes;
119
120 // When Override Compression Times is set to true, any sound under this threshold (in seconds) will be fully decompressed on load.
121 // Otherwise the first chunk of this sound is cached at load and the rest is decompressed in real time.
122 // If set to zero, will default to the Sound Group on the relevant Sound Wave
123 UPROPERTY(EditAnywhere, Category = "DecompressOnLoad")
124 float DurationThreshold;
125
126 // On this platform, any random nodes on Sound Cues will automatically only preload this number of branches and dispose of any others
127 // on load. This can drastically cut down on memory usage. If set to 0, no branches are culled.
128 UPROPERTY(EditAnywhere, Category = "SoundCueLoading", meta = (DisplayName = "Maximum Branches on Random SoundCue nodes", ClampMin = "0"))
129 int32 MaxNumRandomBranches;
130
131 // On this platform, use the specified quality at this index to override the quality used for SoundCues on this platform
132 UPROPERTY(EditAnywhere, Category = "SoundCueLoading", meta = (DisplayName = "Quality Index for Sound Cues", ClampMin = "0", ClampMax = "50"))
133 int32 SoundCueQualityIndex = 1;
134
136
137 // Get singleton containing default settings for compression.
138 static FPlatformRuntimeAudioCompressionOverrides* GetDefaultCompressionOverrides()
139 {
140 if (DefaultCompressionOverrides == nullptr)
141 {
142 DefaultCompressionOverrides = new FPlatformRuntimeAudioCompressionOverrides();
143 }
144
145 return DefaultCompressionOverrides;
146 }
147
148private:
150};
ESoundwaveSampleRateSettings
Definition AudioCompressionSettings.h:15
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition UnrealString.h.inl:34
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition AudioCompressionSettings.h:29
int32 CacheSizeKB
Definition AudioCompressionSettings.h:36
FAudioStreamCachingSettings()
Definition AudioCompressionSettings.h:46
int32 ZerothChunkSizeForLegacyStreamChunkingKB
Definition AudioCompressionSettings.h:41
static constexpr int32 DefaultCacheSize
Definition AudioCompressionSettings.h:30
bool bForceLegacyStreamChunking
Definition AudioCompressionSettings.h:39
int32 MaxChunkSizeOverrideKB
Definition AudioCompressionSettings.h:44
Definition AudioCompressionSettings.h:61
bool bResampleForDevice
Definition AudioCompressionSettings.h:67
float AutoStreamingThreshold
Definition AudioCompressionSettings.h:80
static AUDIOPLATFORMCONFIGURATION_API void GetHashSuffix(const FPlatformAudioCookOverrides *InOverrides, FString &OutSuffix)
Definition AudioCompressionSettings.cpp:28
TMap< ESoundwaveSampleRateSettings, float > PlatformSampleRates
Definition AudioCompressionSettings.h:70
FPlatformAudioCookOverrides()
Definition AudioCompressionSettings.h:93
int32 SoundCueCookQualityIndex
Definition AudioCompressionSettings.h:76
FAudioStreamCachingSettings StreamCachingSettings
Definition AudioCompressionSettings.h:91
static AUDIOPLATFORMCONFIGURATION_API int32 GetStreamCachingVersion()
Definition AudioCompressionSettings.cpp:22
bool bInlineFirstAudioChunk
Definition AudioCompressionSettings.h:83
float CompressionQualityModifier
Definition AudioCompressionSettings.h:73
float LengthOfFirstAudioChunkInSecs
Definition AudioCompressionSettings.h:88
Definition AudioCompressionSettings.h:113