SoundCueCookQualityIndex

SoundCueCookQualityIndex

#Overview

name: SoundCueCookQualityIndex

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 11 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of SoundCueCookQualityIndex is to specify the quality level at which SoundCues should be cooked (processed and prepared) for a specific platform or target. This variable is part of the audio system in Unreal Engine 5, specifically related to the cooking process of audio assets.

This setting variable is primarily used in platform-specific target settings and runtime settings for various platforms such as Linux, Mac, Windows, Android, and iOS. It is part of the audio configuration system and is utilized during the content cooking process.

The value of this variable is typically set in the project settings for each platform. It can be modified through the Unreal Editor’s project settings interface, where it appears under the “Audio|CookOverrides” category with the display name “Sound Cue Cook Quality”.

The SoundCueCookQualityIndex interacts with other audio-related variables and systems, particularly those involved in the cooking and processing of audio assets. It is closely related to the quality levels defined in the UAudioSettings class.

Developers should be aware of the following when using this variable:

  1. When set to a value other than INDEX_NONE, it will cause the cooker to strip all other quality levels from SoundCues, keeping only the specified quality level.
  2. This setting can significantly impact the size and quality of the cooked audio content for the target platform.
  3. It affects how USoundNodeQualityLevel nodes are processed during cooking.

Best practices for using this variable include:

  1. Carefully consider the target platform’s capabilities and requirements when setting this value.
  2. Test the audio quality and performance with different settings to find the optimal balance between quality and resource usage.
  3. Be consistent with the setting across related platforms to maintain audio consistency.
  4. Document the chosen setting and the reasoning behind it for future reference and team communication.
  5. Review and update this setting when making significant changes to the project’s audio assets or target platforms.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:322, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:385, section: [/Script/LinuxTargetPlatform.LinuxTargetSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/Linux/LinuxTargetPlatform/Classes/LinuxTargetSettings.h:41

Scope (from outer to inner):

file
class        class ULinuxTargetSettings : public UObject

Source code excerpt:

	/** Quality Level to COOK SoundCues at (if set, all other levels will be stripped by the cooker). */
	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides", meta = (DisplayName = "Sound Cue Cook Quality"))
	int32 SoundCueCookQualityIndex = INDEX_NONE;

	/**
	 * The collection of RHI's we want to support on this platform.
	 * This is not always the full list of RHI we can support.
	 */
	UPROPERTY(EditAnywhere, config, Category=Rendering)

#Loc: <Workspace>/Engine/Source/Developer/Mac/MacTargetPlatform/Classes/MacTargetSettings.h:165

Scope (from outer to inner):

file
class        class UMacTargetSettings : public UObject

Source code excerpt:

	/** Quality Level to COOK SoundCues at (if set, all other levels will be stripped by the cooker). */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides", meta = (DisplayName = "Sound Cue Cook Quality"))
	int32 SoundCueCookQualityIndex = INDEX_NONE;

};

#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Classes/WindowsTargetSettings.h:144

Scope (from outer to inner):

file
class        class UWindowsTargetSettings : public UObject

Source code excerpt:

	/** Quality Level to COOK SoundCues at (if set, all other levels will be stripped by the cooker). */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides", meta = (DisplayName = "Sound Cue Cook Quality"))
	int32 SoundCueCookQualityIndex = INDEX_NONE;
};

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:615

Scope (from outer to inner):

file
class        class UAndroidRuntimeSettings : public UObject

Source code excerpt:

	/** Quality Level to COOK SoundCues at (if set, all other levels will be stripped by the cooker). */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides", meta = (DisplayName = "Sound Cue Cook Quality"))
	int32 SoundCueCookQualityIndex = INDEX_NONE;

	// Mapping of which sample rates are used for each sample rate quality for a specific platform.

	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Max"))
	float MaxSampleRate;

#Loc: <Workspace>/Engine/Source/Runtime/AudioPlatformConfiguration/Private/AudioCompressionSettings.cpp:54

Scope (from outer to inner):

file
function     void FPlatformAudioCookOverrides::GetHashSuffix

Source code excerpt:


	FPCU::AppendHash(OutSuffix, TEXT("QMOD"), InOverrides->CompressionQualityModifier);
	FPCU::AppendHash(OutSuffix, TEXT("CQLT"), InOverrides->SoundCueCookQualityIndex);
	FPCU::AppendHash(OutSuffix, TEXT("ASTH"), InOverrides->AutoStreamingThreshold);
	FPCU::AppendHash(OutSuffix, TEXT("INLC"), InOverrides->bInlineFirstAudioChunk);
	FPCU::AppendHash(OutSuffix, TEXT("LCK1"), InOverrides->LengthOfFirstAudioChunkInSecs);
	
	// FAudioStreamCachingSettings
	FPCU::AppendHash(OutSuffix, TEXT("CSZE"), InOverrides->StreamCachingSettings.CacheSizeKB);

#Loc: <Workspace>/Engine/Source/Runtime/AudioPlatformConfiguration/Public/AudioCompressionSettings.h:74

Scope: file

Source code excerpt:


	// If set, the cooker will keep only this level of quality
	int32 SoundCueCookQualityIndex = INDEX_NONE;

	// When set to any platform > 0.0, this will automatically set any USoundWave beyond this value to be streamed from disk.
	// If StreamCaching is set to true, this will be used 
	float AutoStreamingThreshold;

	// 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) 

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioCompressionSettingsUtils.cpp:104

Scope (from outer to inner):

file
function     void CacheAudioCookOverrides

Source code excerpt:

	if (PlatformFile->GetInt(*CategoryName, TEXT("SoundCueCookQualityIndex"), SoundCueQualityIndex))
	{
		OutOverrides.SoundCueCookQualityIndex = SoundCueQualityIndex;
	}

	if (bool bInlineFirstAudioChunk = false; PlatformFile->GetBool(*CategoryName, TEXT("bInlineFirstAudioChunk"), bInlineFirstAudioChunk))
	{
		OutOverrides.bInlineFirstAudioChunk = bInlineFirstAudioChunk;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundCue.cpp:144

Scope (from outer to inner):

file
function     void USoundCue::Serialize

Source code excerpt:

		{
			FScopeLock Lock(&EditorOnlyCs);
			CookedQualityIndex = Overrides->SoundCueCookQualityIndex;
			Super::Serialize(Record);
			CookedQualityIndex = INDEX_NONE;
		}
	}
	else
#endif //WITH_EDITOR

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundNodeAssetReferencer.cpp:20

Scope (from outer to inner):

file
function     bool USoundNodeAssetReferencer::ShouldHardReferenceAsset

Source code excerpt:

		{
			// If the Quality nodes are cooked, everything is hard refs.
			if (CookOverrides->SoundCueCookQualityIndex != INDEX_NONE)
			{
				UE_LOG(LogAudio, Verbose, TEXT("HARD reffing '%s:%s', as we are cooking using quality '%s'"),
					*GetNameSafe(GetOuter()),
					*GetName(),
					*GetDefault<UAudioSettings>()->FindQualityNameByIndex(CookOverrides->SoundCueCookQualityIndex)
				)
				return true;
			}
		}
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundNodeQualityLevel.cpp:162

Scope (from outer to inner):

file
function     void USoundNodeQualityLevel::Serialize

Source code excerpt:

			FScopeLock Lock(&EditorOnlyCs);

			if (CookOverrides->SoundCueCookQualityIndex != INDEX_NONE )
			{
				// Set our cook quality, as we serialize. 
				CookedQualityLevelIndex = CookOverrides->SoundCueCookQualityIndex;

				// Move out all nodes.
				TArray<TObjectPtr<class USoundNode>> ChildNodesBackup;
				ChildNodesBackup = MoveTemp(ChildNodes);
				check(ChildNodes.Num() == 0);
			

#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:562

Scope (from outer to inner):

file
class        class UIOSRuntimeSettings : public UObject

Source code excerpt:

	/** Quality Level to COOK SoundCues at (if set, all other levels will be stripped by the cooker). */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides", meta = (DisplayName = "Sound Cue Cook Quality"))
	int32 SoundCueCookQualityIndex = INDEX_NONE;

	// Mapping of which sample rates are used for each sample rate quality for a specific platform.

	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Max"))
	float MaxSampleRate;