CompressionOverrides
CompressionOverrides
#Overview
name: CompressionOverrides
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 50
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of CompressionOverrides is to provide platform-specific audio compression and decompression settings for iOS devices in Unreal Engine 5.
This setting variable is part of the iOS runtime settings and is used by the audio system to determine how audio should be compressed and decompressed on iOS devices. It allows developers to fine-tune audio compression parameters specifically for iOS platforms, which can help optimize audio performance and quality for these devices.
The CompressionOverrides variable is relied upon by the Unreal Engine’s audio subsystem, particularly the parts that handle audio compression and streaming for iOS devices. It’s likely used by the audio engine when processing and playing back audio on iOS platforms.
The value of this variable is set in the iOS Runtime Settings, which can be accessed and modified through the Unreal Engine editor. It’s a configurable property that can be adjusted by developers to suit their project’s needs.
This variable interacts with other audio-related settings in the engine, particularly those dealing with audio compression and streaming. It may affect how audio files are processed during the cooking process for iOS platforms.
Developers should be aware that modifying these compression overrides can impact audio quality, memory usage, and performance on iOS devices. It’s important to test thoroughly after making changes to ensure the desired balance between audio quality and performance is achieved.
Best practices when using this variable include:
- Understanding the specific audio requirements of your iOS app.
- Testing different compression settings to find the optimal balance between audio quality and performance.
- Considering the variety of iOS devices and their capabilities when setting these overrides.
- Coordinating with audio designers to ensure that the compression settings don’t negatively impact the intended audio experience.
- Regularly reviewing and updating these settings as new iOS devices are released or as the project’s audio needs evolve.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:311, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]
- INI Section:
/Script/WindowsTargetPlatform.WindowsTargetSettings
- Raw value:
(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0)
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Classes/WindowsTargetSettings.h:104
Scope (from outer to inner):
file
class class UWindowsTargetSettings : public UObject
Source code excerpt:
/** Various overrides for how this platform should handle compression and decompression */
UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio")
FPlatformRuntimeAudioCompressionOverrides CompressionOverrides;
/** This determines the max amount of memory that should be used for the cache at any given time. If set low (<= 8 MB), it lowers the size of individual chunks of audio during cook. */
UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides|Stream Caching", meta = (DisplayName = "Max Cache Size (KB)"))
int32 CacheSizeKB;
/** This overrides the default max chunk size used when chunking audio for stream caching (ignored if < 0) */
#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:600
Scope (from outer to inner):
file
class class UAndroidRuntimeSettings : public UObject
Source code excerpt:
/** Various overrides for how this platform should handle compression and decompression */
UPROPERTY(config, EditAnywhere, Category = "Audio")
FPlatformRuntimeAudioCompressionOverrides CompressionOverrides;
/** This determines the max amount of memory that should be used for the cache at any given time. If set low (<= 8 MB), it lowers the size of individual chunks of audio during cook. */
UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides|Stream Caching", meta = (DisplayName = "Max Cache Size (KB)"))
int32 CacheSizeKB;
/** This overrides the default max chunk size used when chunking audio for stream caching (ignored if < 0) */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundWave.h:162
Scope: file
Source code excerpt:
#if WITH_EDITORONLY_DATA
ENGINE_API void Cache(class USoundWave& InSoundWave, const FPlatformAudioCookOverrides* CompressionOverrides, FName AudioFormatName, uint32 InFlags, const ITargetPlatform* InTargetPlatform=nullptr);
ENGINE_API void FinishCache();
ENGINE_API bool IsFinishedCache() const;
ENGINE_API bool IsAsyncWorkComplete() const;
ENGINE_API bool IsCompiling() const;
ENGINE_API bool TryInlineChunkData();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundWave.h:1253
Scope: file
Source code excerpt:
*
* @param Format format of compressed data
* @param CompressionOverrides Optional argument for compression overrides.
* @return compressed data size, or zero if it could not be obtained
*/
SIZE_T GetCompressedDataSize(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides = GetPlatformCompressionOverridesForCurrentPlatform())
{
FByteBulkData* Data = GetCompressedData(Format, CompressionOverrides);
return Data ? Data->GetBulkDataSize() : 0;
}
ENGINE_API virtual bool HasCompressedData(FName Format, ITargetPlatform* TargetPlatform = GetRunningPlatform()) const;
#if WITH_EDITOR
/** Utility which returns imported PCM data and the parsed header for the file. Returns true if there was data, false if there wasn't. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundWave.h:1279
Scope (from outer to inner):
file
class class USoundWave : public USoundBase, public IAudioProxyDataFactory, public IInterface_AsyncCompilation
Source code excerpt:
static ENGINE_API FName GetPlatformSpecificFormat(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides);
private:
#if WITH_EDITOR
// Removes any in-progress async loading data formats.
ENGINE_API void FlushAsyncLoadingDataFormats();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundWave.h:1301
Scope (from outer to inner):
file
class class USoundWave : public USoundBase, public IAudioProxyDataFactory, public IInterface_AsyncCompilation
Source code excerpt:
/** Returns if an async task for a certain platform has finished. */
ENGINE_API bool IsCompressedDataReady(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides) const;
ENGINE_API bool IsLoadedFromCookedData() const;
#endif //WITH_EDITOR
ENGINE_API virtual void BeginGetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides, const ITargetPlatform* InTargetPlatform);
/**
* Gets the compressed data from derived data cache for the specified platform
* Warning, the returned pointer isn't valid after we add new formats
*
* @param Format format of compressed data
* @param CompressionOverrides optional platform compression overrides
* @return compressed data, if it could be obtained
*/
ENGINE_API virtual FByteBulkData* GetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides = GetPlatformCompressionOverridesForCurrentPlatform(),
const ITargetPlatform* InTargetPlatform = GetRunningPlatform());
/**
* Change the guid and flush all compressed data
* @param bFreeResources if true, will delete any precached compressed data as well.
*/
ENGINE_API void InvalidateCompressedData(bool bFreeResources = false, bool bRebuildStreamingChunks = true);
/** Returns curves associated with this sound wave */
virtual class UCurveTable* GetCurveData() const override { return Curves; }
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundWave.h:1394
Scope (from outer to inner):
file
class class USoundWave : public USoundBase, public IAudioProxyDataFactory, public IInterface_AsyncCompilation
Source code excerpt:
* Returns a sample rate if there is a specific sample rate override for this platform, -1.0 otherwise.
*/
ENGINE_API float GetSampleRateForCompressionOverrides(const FPlatformAudioCookOverrides* CompressionOverrides);
ENGINE_API void SetError(const TCHAR* InErrorMsg=nullptr);
ENGINE_API void ResetError();
ENGINE_API bool HasError() const;
#if WITH_EDITORONLY_DATA
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundWave.h:1580
Scope (from outer to inner):
file
class class FSoundWaveData
Source code excerpt:
ENGINE_API bool HasCompressedData(FName Format, ITargetPlatform* TargetPlatform = USoundWave::GetRunningPlatform()) const;
ENGINE_API FByteBulkData* GetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides = USoundWave::GetPlatformCompressionOverridesForCurrentPlatform());
ENGINE_API bool GetChunkData(int32 ChunkIndex, uint8** OutChunkData, bool bMakeSureChunkIsLoaded = false);
ENGINE_API bool IsZerothChunkDataLoaded() const;
ENGINE_API const TArrayView<uint8> GetZerothChunkDataView() const;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundWave.h:1732
Scope (from outer to inner):
file
class class FSoundWaveProxy : public Audio::TProxyData<FSoundWaveProxy>
Source code excerpt:
ENGINE_API const TArrayView<uint8> GetZerothChunkDataView() const;
ENGINE_API FByteBulkData* GetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides = USoundWave::GetPlatformCompressionOverridesForCurrentPlatform());
static ENGINE_API TArrayView<const uint8> GetZerothChunk(const FSoundWaveProxyPtr& SoundWaveProxy, bool bForImmediatePlayback = false);
#if WITH_EDITOR
ENGINE_API int32 GetCurrentChunkRevision() const;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundWaveProcedural.h:68
Scope (from outer to inner):
file
class class USoundWaveProcedural : public USoundWave
Source code excerpt:
ENGINE_API virtual int32 GeneratePCMData(uint8* PCMData, const int32 SamplesNeeded) override;
ENGINE_API virtual bool HasCompressedData(FName Format, ITargetPlatform* TargetPlatform) const override;
ENGINE_API virtual void BeginGetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides, const ITargetPlatform* InTargetPlatform) override;
ENGINE_API virtual FByteBulkData* GetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides, const ITargetPlatform* InTargetPlatform) override;
ENGINE_API virtual void InitAudioResource( FByteBulkData& CompressedData ) override;
ENGINE_API virtual bool InitAudioResource(FName Format) override;
ENGINE_API virtual int32 GetResourceSizeForFormat(FName Format) override;
//~ End USoundWave Interface.
// Virtual function to generate PCM audio from the audio render thread.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioCompressionSettingsUtils.cpp:57
Scope (from outer to inner):
file
function const FPlatformRuntimeAudioCompressionOverrides* FPlatformCompressionUtilities::GetRuntimeCompressionOverridesForCurrentPlatform
Source code excerpt:
if (Settings)
{
return &(Settings->CompressionOverrides);
}
#elif PLATFORM_IOS && ENABLE_PLATFORM_COMPRESSION_OVERRIDES
static const UIOSRuntimeSettings* Settings = GetDefault<UIOSRuntimeSettings>();
if (Settings)
{
return &(Settings->CompressionOverrides);
}
#elif PLATFORM_SWITCH && ENABLE_PLATFORM_COMPRESSION_OVERRIDES
static const USwitchRuntimeSettings* Settings = GetDefault<USwitchRuntimeSettings>();
if (Settings)
{
return &(Settings->CompressionOverrides);
}
#endif // PLATFORM_ANDROID
return nullptr;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:232
Scope (from outer to inner):
file
function static void GetStreamedAudioDerivedDataKeySuffix
Source code excerpt:
const USoundWave& SoundWave,
FName AudioFormatName,
const FPlatformAudioCookOverrides* CompressionOverrides,
const ITargetPlatform* InTargetPlatform,
FString& OutKeySuffix
)
{
uint16 Version = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:253
Scope (from outer to inner):
file
function static void GetStreamedAudioDerivedDataKeySuffix
Source code excerpt:
// If we have compression overrides for this target platform, append them to this string.
if (CompressionOverrides)
{
FPlatformAudioCookOverrides::GetHashSuffix(CompressionOverrides, AudioFormatNameString);
}
const FString SoundWaveHash = GetSoundWaveHash(SoundWave, InTargetPlatform);
// build the key
OutKeySuffix = FString::Printf(TEXT("%s_%d_%s_%s"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:319
Scope (from outer to inner):
file
function static void GetStreamedAudioDerivedDataKey
Source code excerpt:
const USoundWave& SoundWave,
FName AudioFormatName,
const FPlatformAudioCookOverrides* CompressionOverrides,
const ITargetPlatform* InTargetPlatform,
FString& OutKey
)
{
FString KeySuffix;
GetStreamedAudioDerivedDataKeySuffix(SoundWave, AudioFormatName, CompressionOverrides, InTargetPlatform, KeySuffix);
GetStreamedAudioDerivedDataKeyFromSuffix(KeySuffix, OutKey);
}
/**
* Gets Wave format for a SoundWave on the current running platform
* @param SoundWave - The SoundWave to get format for.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:447
Scope (from outer to inner):
file
class class FStreamedAudioCacheDerivedDataWorker : public FNonAbandonableTask
Source code excerpt:
uint32 BytesCached = 0;
/** Sample rate override specified for this sound wave. */
const FPlatformAudioCookOverrides* CompressionOverrides = nullptr;
/** true if caching has succeeded. */
bool bSucceeded = false;
/** true if the derived data was pulled from DDC */
bool bLoadedFromDDC = false;
/** Already tried to built once */
bool bHasBeenBuilt = false;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:761
Scope (from outer to inner):
file
class class FStreamedAudioCacheDerivedDataWorker : public FNonAbandonableTask
function void BuildStreamedAudio
Source code excerpt:
const int32 MinimumChunkSize = AudioFormat->GetMinimumSizeForInitialChunk(AudioFormatName, CompressedBuffer);
const bool bForceLegacyStreamChunking = bIsStreaming && CompressionOverrides && CompressionOverrides->StreamCachingSettings.bForceLegacyStreamChunking;
// If the zeroth size for this sound wave was overridden, use that:
if (ZerothChunkSizeSoundWaveOverride > 0)
{
ZerothChunkSize = FMath::Max(MinimumChunkSize, ZerothChunkSizeSoundWaveOverride);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:776
Scope (from outer to inner):
file
class class FStreamedAudioCacheDerivedDataWorker : public FNonAbandonableTask
function void BuildStreamedAudio
Source code excerpt:
if (bForceLegacyStreamChunking)
{
int32 LegacyZerothChunkSize = CompressionOverrides->StreamCachingSettings.ZerothChunkSizeForLegacyStreamChunkingKB * 1024;
if (LegacyZerothChunkSize == 0)
{
LegacyZerothChunkSize = MaxChunkSizeForCurrentWave;
}
ZerothChunkSize = LegacyZerothChunkSize;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:794
Scope (from outer to inner):
file
class class FStreamedAudioCacheDerivedDataWorker : public FNonAbandonableTask
function void BuildStreamedAudio
Source code excerpt:
{
// Use the chunk size for this duration:
MaxChunkSizeForCurrentWave = FPlatformCompressionUtilities::GetMaxChunkSizeForCookOverrides(CompressionOverrides);
// observe the override chunk size now that we have set the
const int32 MaxChunkSizeOverrideBytes = CompressionOverrides->StreamCachingSettings.MaxChunkSizeOverrideKB * 1024;
if (MaxChunkSizeOverrideBytes > 0)
{
MaxChunkSizeForCurrentWave = FMath::Min(MaxChunkSizeOverrideBytes, MaxChunkSizeForCurrentWave);
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:810
Scope (from outer to inner):
file
class class FStreamedAudioCacheDerivedDataWorker : public FNonAbandonableTask
function void BuildStreamedAudio
Source code excerpt:
// If platform is configured to so, optionally inline the first Audio chunk and size it with the specific requirements.
// Value of zero will do nothing.
const bool bInlineFirstAudioChunk = CompressionOverrides->bInlineFirstAudioChunk && !bForceLegacyStreamChunking;
uint32 MaxLengthOfFirstAudioChunkInFrames = MAX_uint32;
if (bInlineFirstAudioChunk)
{
MaxLengthOfFirstAudioChunkInFrames = SizeOfFirstAudioChunkInFrames;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:976
Scope (from outer to inner):
file
class class FStreamedAudioCacheDerivedDataWorker : public FNonAbandonableTask
function FStreamedAudioCacheDerivedDataWorker
Source code excerpt:
, AudioFormatName(InAudioFormatName)
, CacheFlags(InCacheFlags)
, CompressionOverrides(InCompressionOverrides)
, bIsProcedural(InSoundWave->IsA<USoundWaveProcedural>())
, bIsStreaming(InSoundWave->bStreaming)
, ZerothChunkSizeSoundWaveOverride(InSoundWave->InitialChunkSize_DEPRECATED)
{
// Gather all USoundWave object inputs to avoid race-conditions that could result when touching the UObject from another thread.
GetStreamedAudioDerivedDataKeySuffix(*InSoundWave, AudioFormatName, CompressionOverrides, InTargetPlatform, KeySuffix);
const FName PlatformSpecificFormat = InSoundWave->GetPlatformSpecificFormat(InAudioFormatName, CompressionOverrides);
// Cache num channels (only used for logging currently).
NumChannels = InSoundWave->NumChannels;
// Cache the sample-rate (making sure to use the compression overrides version for this platform).
const float OverrideSampleRate = InSoundWave->GetSampleRateForCompressionOverrides(InCompressionOverrides);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:998
Scope (from outer to inner):
file
class class FStreamedAudioCacheDerivedDataWorker : public FNonAbandonableTask
function FStreamedAudioCacheDerivedDataWorker
Source code excerpt:
// Fetch compressed data directly from the DDC to ensure thread-safety. Will be async if the compressor is thread-safe.
FDerivedAudioDataCompressor* DeriveAudioData = new FDerivedAudioDataCompressor(InSoundWave, InAudioFormatName, PlatformSpecificFormat, CompressionOverrides, InTargetPlatform);
CompressedAudioHandle = GetDerivedDataCacheRef().GetAsynchronous(DeriveAudioData);
}
/** Does the work to cache derived data. Safe to call from any thread. */
void DoWork()
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:1113
Scope (from outer to inner):
file
function void FStreamedAudioPlatformData::Cache
Source code excerpt:
};
void FStreamedAudioPlatformData::Cache(USoundWave& InSoundWave, const FPlatformAudioCookOverrides* CompressionOverrides, FName AudioFormatName, uint32 InFlags, const ITargetPlatform* InTargetPlatform)
{
TRACE_CPUPROFILER_EVENT_SCOPE(FStreamedAudioPlatformData::Cache);
// Flush any existing async task and ignore results.
FinishCache();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:1130
Scope (from outer to inner):
file
function void FStreamedAudioPlatformData::Cache
Source code excerpt:
bool bForceRebuild = (Flags & EStreamedAudioCacheFlags::ForceRebuild) != 0;
bool bAsync = (Flags & EStreamedAudioCacheFlags::Async) != 0;
GetStreamedAudioDerivedDataKey(InSoundWave, AudioFormatName, CompressionOverrides, InTargetPlatform, DerivedDataKey);
if (bAsync && !bForceRebuild && FSoundWaveCompilingManager::Get().IsAsyncCompilationAllowed(&InSoundWave))
{
FQueuedThreadPool* SoundWaveThreadPool = FSoundWaveCompilingManager::Get().GetThreadPool();
EQueuedWorkPriority BasePriority = FSoundWaveCompilingManager::Get().GetBasePriority(&InSoundWave);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:1140
Scope (from outer to inner):
file
function void FStreamedAudioPlatformData::Cache
Source code excerpt:
FWriteScopeLock AsyncTaskScope(AsyncTaskLock.Get());
check(AsyncTask == nullptr);
AsyncTask = new FStreamedAudioAsyncCacheDerivedDataTask(this, &InSoundWave, CompressionOverrides, AudioFormatName, Flags, InTargetPlatform);
int64 RequiredMemory = -1; // @todo RequiredMemory
AsyncTask->StartBackgroundTask(SoundWaveThreadPool, BasePriority, EQueuedWorkFlags::DoNotRunInsideBusyWait, RequiredMemory, TEXT("AudioDerivedData") );
}
if (IsInAudioThread())
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:1163
Scope (from outer to inner):
file
function void FStreamedAudioPlatformData::Cache
Source code excerpt:
else
{
FStreamedAudioCacheDerivedDataWorker Worker(this, &InSoundWave, CompressionOverrides, AudioFormatName, Flags, InTargetPlatform);
{
COOK_STAT(auto Timer = AudioCookStats::UsageStats.TimeSyncWork());
Worker.DoWork();
Worker.Finalize();
COOK_STAT(Timer.AddHitOrMiss(Worker.WasLoadedFromDDC() ? FCookStats::CallStats::EHitOrMiss::Hit : FCookStats::CallStats::EHitOrMiss::Miss, Worker.GetBytesCached()));
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2164
Scope (from outer to inner):
file
function void USoundWave::SerializeCookedPlatformData
Source code excerpt:
FName PlatformFormat = Ar.CookingTarget()->GetWaveFormat(this);
const FPlatformAudioCookOverrides* CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides(*Ar.CookingTarget()->IniPlatformName());
FString DerivedDataKey;
GetStreamedAudioDerivedDataKeySuffix(*this, PlatformFormat, CompressionOverrides, Ar.CookingTarget(), DerivedDataKey);
FStreamedAudioPlatformData *PlatformDataToSave = CookedPlatformData.FindRef(DerivedDataKey);
if (PlatformDataToSave == NULL)
{
PlatformDataToSave = new FStreamedAudioPlatformData();
PlatformDataToSave->Cache(*this, CompressionOverrides, PlatformFormat, EStreamedAudioCacheFlags::InlineChunks | EStreamedAudioCacheFlags::Async, Ar.CookingTarget());
CookedPlatformData.Add(DerivedDataKey, PlatformDataToSave);
}
PlatformDataToSave->FinishCache();
PlatformDataToSave->Serialize(Ar, this);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2208
Scope (from outer to inner):
file
function void USoundWave::CachePlatformData
Source code excerpt:
FString DerivedDataKey;
FName AudioFormat = GetWaveFormatForRunningPlatform(*this);
const FPlatformAudioCookOverrides* CompressionOverrides = GetCookOverridesForRunningPlatform();
GetStreamedAudioDerivedDataKey(*this, AudioFormat, CompressionOverrides, GetRunningPlatform(), DerivedDataKey);
if (SoundWaveDataPtr->RunningPlatformData.DerivedDataKey != DerivedDataKey)
{
const uint32 CacheFlags = bAsyncCache ? (EStreamedAudioCacheFlags::Async | EStreamedAudioCacheFlags::AllowAsyncBuild) : EStreamedAudioCacheFlags::None;
SoundWaveDataPtr->RunningPlatformData.Cache(*this, CompressionOverrides, AudioFormat, CacheFlags, GetRunningPlatform());
}
}
void USoundWave::BeginCachePlatformData()
{
CachePlatformData(true);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2242
Scope (from outer to inner):
file
function void USoundWave::BeginCacheForCookedPlatformData
Source code excerpt:
TRACE_CPUPROFILER_EVENT_SCOPE(USoundWave::BeginCacheForCookedPlatformData);
const FPlatformAudioCookOverrides* CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides(*TargetPlatform->IniPlatformName());
if (TargetPlatform->AllowAudioVisualData())
{
// Retrieve format to cache for targetplatform.
FName PlatformFormat = TargetPlatform->GetWaveFormat(this);
if (TargetPlatform->SupportsFeature(ETargetPlatformFeatures::AudioStreaming) && IsStreaming(*CompressionOverrides))
{
// Always allow the build to be performed asynchronously as it is now thread-safe by fetching compressed data directly from the DDC.
uint32 CacheFlags = EStreamedAudioCacheFlags::Async | EStreamedAudioCacheFlags::InlineChunks | EStreamedAudioCacheFlags::AllowAsyncBuild;
// find format data by comparing derived data keys.
FString DerivedDataKey;
GetStreamedAudioDerivedDataKeySuffix(*this, PlatformFormat, CompressionOverrides, TargetPlatform, DerivedDataKey);
FStreamedAudioPlatformData *PlatformData = CookedPlatformData.FindRef(DerivedDataKey);
if (PlatformData == nullptr)
{
PlatformData = new FStreamedAudioPlatformData();
PlatformData->Cache(
*this,
CompressionOverrides,
PlatformFormat,
CacheFlags,
TargetPlatform
);
CookedPlatformData.Add(DerivedDataKey, PlatformData);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2275
Scope (from outer to inner):
file
function void USoundWave::BeginCacheForCookedPlatformData
Source code excerpt:
else
{
BeginGetCompressedData(PlatformFormat, CompressionOverrides, TargetPlatform);
}
}
Super::BeginCacheForCookedPlatformData(TargetPlatform);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2286
Scope (from outer to inner):
file
function bool USoundWave::IsCachedCookedPlatformDataLoaded
Source code excerpt:
TRACE_CPUPROFILER_EVENT_SCOPE(USoundWave::IsCachedCookedPlatformDataLoaded);
const FPlatformAudioCookOverrides* CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides(*TargetPlatform->IniPlatformName());
if (TargetPlatform->AllowAudioVisualData())
{
// Retrieve format to cache for targetplatform.
FName PlatformFormat = TargetPlatform->GetWaveFormat(this);
if (TargetPlatform->SupportsFeature(ETargetPlatformFeatures::AudioStreaming) && IsStreaming(*CompressionOverrides))
{
// find format data by comparing derived data keys.
FString DerivedDataKey;
GetStreamedAudioDerivedDataKeySuffix(*this, PlatformFormat, CompressionOverrides, TargetPlatform, DerivedDataKey);
FStreamedAudioPlatformData *PlatformData = CookedPlatformData.FindRef(DerivedDataKey);
if (PlatformData == nullptr)
{
// we haven't called begincache
return false;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2315
Scope (from outer to inner):
file
function bool USoundWave::IsCachedCookedPlatformDataLoaded
Source code excerpt:
else
{
return IsCompressedDataReady(PlatformFormat, CompressionOverrides);
}
}
return true;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2347
Scope (from outer to inner):
file
function void USoundWave::ClearCachedCookedPlatformData
Source code excerpt:
Super::ClearCachedCookedPlatformData(TargetPlatform);
const FPlatformAudioCookOverrides* CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides(*TargetPlatform->IniPlatformName());
if (TargetPlatform->SupportsFeature(ETargetPlatformFeatures::AudioStreaming) && IsStreaming(*CompressionOverrides))
{
// Retrieve format to cache for targetplatform.
FName PlatformFormat = TargetPlatform->GetWaveFormat(this);
// find format data by comparing derived data keys.
FString DerivedDataKey;
GetStreamedAudioDerivedDataKeySuffix(*this, PlatformFormat, CompressionOverrides, TargetPlatform, DerivedDataKey);
if ( CookedPlatformData.Contains(DerivedDataKey) )
{
FStreamedAudioPlatformData *PlatformData = CookedPlatformData.FindAndRemoveChecked( DerivedDataKey );
delete PlatformData;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2404
Scope (from outer to inner):
file
function void USoundWave::FinishCachePlatformData
Source code excerpt:
FString DerivedDataKey;
FName AudioFormat = GetWaveFormatForRunningPlatform(*this);
const FPlatformAudioCookOverrides* CompressionOverrides = GetCookOverridesForRunningPlatform();
GetStreamedAudioDerivedDataKey(*this, AudioFormat,CompressionOverrides, GetRunningPlatform(), DerivedDataKey);
UE_CLOG(SoundWaveDataPtr->RunningPlatformData.DerivedDataKey != DerivedDataKey, LogAudio, Warning, TEXT("Audio was cooked with the DDC key %s but should've had the DDC key %s. the cook overrides/codec used may be incorrect."), *SoundWaveDataPtr->RunningPlatformData.DerivedDataKey, *DerivedDataKey);
}
#endif
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDerivedData.cpp:2415
Scope (from outer to inner):
file
function void USoundWave::ForceRebuildPlatformData
Source code excerpt:
{
check(SoundWaveDataPtr);
const FPlatformAudioCookOverrides* CompressionOverrides = GetCookOverridesForRunningPlatform();
SoundWaveDataPtr->RunningPlatformData.Cache(
*this,
CompressionOverrides,
GetWaveFormatForRunningPlatform(*this),
EStreamedAudioCacheFlags::ForceRebuild,
GetRunningPlatform()
);
}
#endif //WITH_EDITORONLY_DATA
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:350
Scope (from outer to inner):
file
function bool FSoundWaveData::HasCompressedData
Source code excerpt:
}
const FPlatformAudioCookOverrides* CompressionOverrides = nullptr;
if (GIsEditor)
{
if (TargetPlatform)
{
CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides(*TargetPlatform->IniPlatformName());
}
}
else
{
// TargetPlatform is not available on consoles/mobile, so we have to grab it ourselves:
CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides();
}
if (CompressionOverrides)
{
#if WITH_EDITOR
FName PlatformSpecificFormat;
FString HashedString = *Format.ToString();
FPlatformAudioCookOverrides::GetHashSuffix(CompressionOverrides, HashedString);
PlatformSpecificFormat = *HashedString;
#else
// on non-editor builds, we cache the concatenated format in a static FName.
static FName PlatformSpecificFormat;
static FName CachedFormat;
if (!Format.IsEqual(CachedFormat))
{
FString HashedString = *Format.ToString();
FPlatformAudioCookOverrides::GetHashSuffix(CompressionOverrides, HashedString);
PlatformSpecificFormat = *HashedString;
CachedFormat = Format;
}
#endif // WITH_EDITOR
return CompressedFormatData.Contains(PlatformSpecificFormat);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:414
Scope (from outer to inner):
file
function FByteBulkData* FSoundWaveData::GetCompressedData
Source code excerpt:
}
FByteBulkData* FSoundWaveData::GetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides)
{
if (IsTemplate() || IsRunningDedicatedServer())
{
return nullptr;
}
TRACE_CPUPROFILER_EVENT_SCOPE(FSoundWaveProxy::GetCompressedData);
FName PlatformSpecificFormat = USoundWave::GetPlatformSpecificFormat(Format, CompressionOverrides);
bool bContainedValidData = CompressedFormatData.Contains(PlatformSpecificFormat);
if (!bContainedValidData)
{
// the proxy does not support interaction w/ FDerivedAudioDataCompressor
return nullptr;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1240
Scope (from outer to inner):
file
function void USoundWave::Serialize
Source code excerpt:
// for now we only support one format per wave
FName Format = CookingTarget->GetWaveFormat(this);
const FPlatformAudioCookOverrides* CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides(*CookingTarget->IniPlatformName());
GetCompressedData(Format, CompressionOverrides); // Get the data from the DDC or build it
if (CompressionOverrides)
{
FString HashedString = *Format.ToString();
FPlatformAudioCookOverrides::GetHashSuffix(CompressionOverrides, HashedString);
FName PlatformSpecificFormat = *HashedString;
ActualFormatsToSave.Add(PlatformSpecificFormat);
}
else
{
ActualFormatsToSave.Add(Format);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1439
Scope (from outer to inner):
file
function bool USoundWave::HasCompressedData
Source code excerpt:
}
const FPlatformAudioCookOverrides* CompressionOverrides = nullptr;
if (GIsEditor)
{
if (TargetPlatform)
{
CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides(*TargetPlatform->IniPlatformName());
}
}
else
{
// TargetPlatform is not available on consoles/mobile, so we have to grab it ourselves:
CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides();
}
if (CompressionOverrides)
{
#if WITH_EDITOR
FName PlatformSpecificFormat;
FString HashedString = *Format.ToString();
FPlatformAudioCookOverrides::GetHashSuffix(CompressionOverrides, HashedString);
PlatformSpecificFormat = *HashedString;
#else
// on non-editor builds, we cache the concatenated format in a static FName.
static FName PlatformSpecificFormat;
static FName CachedFormat;
if (!Format.IsEqual(CachedFormat))
{
FString HashedString = *Format.ToString();
FPlatformAudioCookOverrides::GetHashSuffix(CompressionOverrides, HashedString);
PlatformSpecificFormat = *HashedString;
CachedFormat = Format;
}
#endif // WITH_EDITOR
return SoundWaveDataPtr->CompressedFormatData.Contains(PlatformSpecificFormat);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1664
Scope (from outer to inner):
file
function FName USoundWave::GetPlatformSpecificFormat
Source code excerpt:
#endif
FName USoundWave::GetPlatformSpecificFormat(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides)
{
// Platforms that require compression overrides get concatenated formats.
#if WITH_EDITOR
FName PlatformSpecificFormat;
if (CompressionOverrides)
{
FString HashedString = *Format.ToString();
FPlatformAudioCookOverrides::GetHashSuffix(CompressionOverrides, HashedString);
PlatformSpecificFormat = *HashedString;
}
else
{
PlatformSpecificFormat = Format;
}
#else
if (CompressionOverrides == nullptr)
{
CompressionOverrides = GetPlatformCompressionOverridesForCurrentPlatform();
}
// Cache the concatenated hash:
static FName PlatformSpecificFormat;
static FName CachedFormat;
if (!Format.IsEqual(CachedFormat))
{
if (CompressionOverrides)
{
FString HashedString = *Format.ToString();
FPlatformAudioCookOverrides::GetHashSuffix(CompressionOverrides, HashedString);
PlatformSpecificFormat = *HashedString;
}
else
{
PlatformSpecificFormat = Format;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1709
Scope (from outer to inner):
file
function void USoundWave::BeginGetCompressedData
Source code excerpt:
}
void USoundWave::BeginGetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides, const ITargetPlatform* InTargetPlatform)
{
TRACE_CPUPROFILER_EVENT_SCOPE(USoundWave::BeginGetCompressedData);
check(SoundWaveDataPtr);
#if WITH_EDITOR
if (IsTemplate() || IsRunningDedicatedServer() || bLoadedFromCookedData)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1723
Scope (from outer to inner):
file
function void USoundWave::BeginGetCompressedData
Source code excerpt:
InvalidateSoundWaveIfNeccessary();
FName PlatformSpecificFormat = GetPlatformSpecificFormat(Format, CompressionOverrides);
if (!SoundWaveDataPtr->CompressedFormatData.Contains(PlatformSpecificFormat) && !AsyncLoadingDataFormats.Contains(PlatformSpecificFormat))
{
if (GetDerivedDataCache())
{
COOK_STAT(auto Timer = SoundWaveCookStats::UsageStats.TimeSyncWork());
COOK_STAT(Timer.TrackCyclesOnly());
FDerivedAudioDataCompressor* DeriveAudioData = new FDerivedAudioDataCompressor(this, Format, PlatformSpecificFormat, CompressionOverrides, InTargetPlatform);
uint32 GetHandle = GetDerivedDataCacheRef().GetAsynchronous(DeriveAudioData);
AsyncLoadingDataFormats.Add(PlatformSpecificFormat, GetHandle);
}
else
{
UE_LOG(LogAudio, Error, TEXT("Attempt to access the DDC when there is none available on sound '%s', format = %s."), *GetFullName(), *PlatformSpecificFormat.ToString());
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1747
Scope (from outer to inner):
file
function bool USoundWave::IsCompressedDataReady
Source code excerpt:
#if WITH_EDITOR
bool USoundWave::IsCompressedDataReady(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides) const
{
TRACE_CPUPROFILER_EVENT_SCOPE(USoundWave::IsCompressedDataReady);
FName PlatformSpecificFormat = GetPlatformSpecificFormat(Format, CompressionOverrides);
const uint32* AsyncHandle = AsyncLoadingDataFormats.Find(PlatformSpecificFormat);
if (AsyncHandle)
{
return GetDerivedDataCacheRef().PollAsynchronousCompletion(*AsyncHandle);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1769
Scope (from outer to inner):
file
function FByteBulkData* USoundWave::GetCompressedData
Source code excerpt:
#endif
FByteBulkData* USoundWave::GetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides, const ITargetPlatform* InTargetPlatform )
{
check(SoundWaveDataPtr);
if (IsTemplate() || IsRunningDedicatedServer())
{
return nullptr;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1779
Scope (from outer to inner):
file
function FByteBulkData* USoundWave::GetCompressedData
Source code excerpt:
TRACE_CPUPROFILER_EVENT_SCOPE(USoundWave::GetCompressedData);
FName PlatformSpecificFormat = GetPlatformSpecificFormat(Format, CompressionOverrides);
bool bContainedValidData = SoundWaveDataPtr->CompressedFormatData.Contains(PlatformSpecificFormat);
FByteBulkData* Result = &SoundWaveDataPtr->CompressedFormatData.GetFormat(PlatformSpecificFormat);
if (!bContainedValidData)
{
if (!FPlatformProperties::RequiresCookedData() && GetDerivedDataCache())
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:1808
Scope (from outer to inner):
file
function FByteBulkData* USoundWave::GetCompressedData
Source code excerpt:
#endif
{
FDerivedAudioDataCompressor* DeriveAudioData = new FDerivedAudioDataCompressor(this, Format, PlatformSpecificFormat, CompressionOverrides, InTargetPlatform);
bGetSuccessful = GetDerivedDataCacheRef().GetSynchronous(DeriveAudioData, OutData, &bDataWasBuilt);
}
if (bGetSuccessful)
{
COOK_STAT(Timer.AddHitOrMiss(bDataWasBuilt ? FCookStats::CallStats::EHitOrMiss::Miss : FCookStats::CallStats::EHitOrMiss::Hit, OutData.Num()));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:2461
Scope (from outer to inner):
file
function float USoundWave::GetSizeOfFirstAudioChunkInSeconds
Source code excerpt:
// If that's not set to anything fallback to setting on cook overrides, if there's anything set.
if (const FPlatformAudioCookOverrides* CompressionOverrides = FPlatformCompressionUtilities::GetCookOverrides(*PlatformName.ToString()))
{
return CompressionOverrides->LengthOfFirstAudioChunkInSecs;
}
}
#endif //WITH_EDITORONLY_DATA
// Nothing.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:3889
Scope (from outer to inner):
file
function float USoundWave::GetSampleRateForCompressionOverrides
Source code excerpt:
}
float USoundWave::GetSampleRateForCompressionOverrides(const FPlatformAudioCookOverrides* CompressionOverrides)
{
const float* SampleRatePtr = CompressionOverrides->PlatformSampleRates.Find(SampleRateQuality);
if (SampleRatePtr && *SampleRatePtr > 0.0f)
{
// If in editor (but not cooking), then read from current platform
// otherwise, use the given cook override sample rate
if (!IsRunningCookCommandlet() && GIsEditor)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWave.cpp:4802
Scope (from outer to inner):
file
function FByteBulkData* FSoundWaveProxy::GetCompressedData
Source code excerpt:
}
FByteBulkData* FSoundWaveProxy::GetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides)
{
check(SoundWaveDataPtr);
return SoundWaveDataPtr->GetCompressedData(Format, CompressionOverrides);
}
TArrayView<const uint8> FSoundWaveProxy::GetZerothChunk(const FSoundWaveProxyPtr& SoundWaveProxy, bool bForImmediatePlayback)
{
if (ensure(SoundWaveProxy.IsValid()))
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundWaveProcedural.cpp:166
Scope (from outer to inner):
file
function void USoundWaveProcedural::BeginGetCompressedData
Source code excerpt:
}
void USoundWaveProcedural::BeginGetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides, const ITargetPlatform* InTargetPlatform)
{
// SoundWaveProcedural does not have compressed data and should generally not be asked about it
}
FByteBulkData* USoundWaveProcedural::GetCompressedData(FName Format, const FPlatformAudioCookOverrides* CompressionOverrides, const ITargetPlatform* InTargetPlatform )
{
// SoundWaveProcedural does not have compressed data and should generally not be asked about it
return nullptr;
}
void USoundWaveProcedural::Serialize(FArchive& Ar)
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:543
Scope (from outer to inner):
file
class class UIOSRuntimeSettings : public UObject
Source code excerpt:
/** Various overrides for how this platform should handle compression and decompression */
UPROPERTY(config, EditAnywhere, Category = "Audio")
FPlatformRuntimeAudioCompressionOverrides CompressionOverrides;
/** Whether this app's audio can be played when using other apps or on the springboard */
UPROPERTY(config, EditAnywhere, Category = "Audio", meta = (DisplayName = "Enable Background Audio"))
bool bSupportsBackgroundAudio;
/** This determines the max amount of memory that should be used for the cache at any given time. If set low (<= 8 MB), it lowers the size of individual chunks of audio during cook. */