PlatformStreamingFormat

PlatformStreamingFormat

#Overview

name: PlatformStreamingFormat

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of PlatformStreamingFormat is to specify the audio format used for streaming audio content on a particular platform in Unreal Engine 5. This setting is part of the audio system configuration and is used to determine the appropriate format for streaming audio assets.

The Unreal Engine audio system relies on this setting variable, particularly within the Engine module. It is used in the FAudioFormatSettings class, which is responsible for managing audio format configurations.

The value of this variable is set in the configuration file, typically read from the “Audio” section with the key “PlatformStreamingFormat”. If not specified in the configuration, it defaults to “ADPCM” (Adaptive Differential Pulse-Code Modulation).

PlatformStreamingFormat interacts with other variables in the FAudioFormatSettings class, such as PlatformFormat (used for non-streaming audio), FallbackFormat (used when the specified format is not available), and AllWaveFormats (a list of all available audio formats).

Developers must be aware that:

  1. The specified format must be included in the AllWaveFormats list.
  2. If an invalid format is specified, the system will use the FallbackFormat instead.
  3. This setting affects only streaming audio assets, while non-streaming assets use the PlatformFormat setting.

Best practices when using this variable include:

  1. Ensure the chosen format is supported on the target platform and included in AllWaveFormats.
  2. Consider the trade-offs between audio quality and file size when selecting a format.
  3. Test the audio performance with the chosen format on target devices to ensure optimal streaming performance.
  4. Document the chosen format and any platform-specific considerations for the development team.
  5. Regularly review and update the format choice as new audio compression technologies become available or platform support changes.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:1569, section: [Audio]

Location: <Workspace>/Engine/Config/Android/AndroidEngine.ini:17, section: [Audio]

Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:41, section: [Audio]

Location: <Workspace>/Engine/Config/Linux/LinuxEngine.ini:5, section: [Audio]

Location: <Workspace>/Engine/Config/Mac/BaseMacEngine.ini:6, section: [Audio]

Location: <Workspace>/Engine/Config/Windows/WindowsEngine.ini:5, section: [Audio]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/AudioFormatSettings.h:28

Scope (from outer to inner):

file
namespace    Audio
class        class FAudioFormatSettings

Source code excerpt:

		TArray<FName> WaveFormatModuleHints;
		FName PlatformFormat;
		FName PlatformStreamingFormat;
		FName FallbackFormat;
	};
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioFormatSettings.cpp:60

Scope (from outer to inner):

file
namespace    Audio
function     FName FAudioFormatSettings::GetWaveFormat

Source code excerpt:

				if (Wave->IsStreaming())
				{
					FormatName = PlatformStreamingFormat;
				}
				else
				{
					FormatName = PlatformFormat;
				}
			}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioFormatSettings.cpp:158

Scope (from outer to inner):

file
namespace    Audio
function     void FAudioFormatSettings::ReadConfiguration

Source code excerpt:

		}

		// PlatformStreamingFormat
		{
			FString PlatformStreamingFormatString;
			if (InConfigSystem->GetString(TEXT("Audio"), TEXT("PlatformStreamingFormat"), PlatformStreamingFormatString, InConfigFilename))
			{
				PlatformStreamingFormat = *PlatformStreamingFormatString;		
			}
			else
			{
				PlatformStreamingFormat = NAME_ADPCM;
				UE_LOG(LogAudio, Warning, TEXT("Audio:PlatformStreamingFormat is not defined, defaulting to '%s'."), *PlatformStreamingFormat.GetPlainNameString());
			}
			if (!AllWaveFormats.Contains(PlatformStreamingFormat))
			{
				UE_LOG(LogAudio, Warning, TEXT("PlatformStreamingFormat '%s' not defined in 'AllWaveFormats'. Using fallback format '%s'"), *PlatformStreamingFormatString, *FallbackFormat.ToString());
				PlatformStreamingFormat = FallbackFormat;
			}
		}

		UE_LOG(LogAudio, Verbose, TEXT("AudioFormatSettings: TargetName='%s', AllWaveFormats=(%s), Hints=(%s), PlatformFormat='%s', PlatformStreamingFormat='%s', FallbackFormat='%s'"),
			*InPlatformIdentifierForLogging, *MakePrettyArrayToString(AllWaveFormats), *MakePrettyArrayToString(WaveFormatModuleHints), *PlatformFormat.ToString(), *PlatformStreamingFormat.ToString(), *FallbackFormat.ToString());	
	}

}// namespace Audio