AllWaveFormats
AllWaveFormats
#Overview
name: AllWaveFormats
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 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AllWaveFormats is to store a list of all supported wave formats in the Unreal Engine audio system. It is used to define and manage the various audio formats that can be processed and played within the engine.
This setting variable is primarily used in the Unreal Engine’s audio subsystem, specifically within the Audio namespace and the FAudioFormatSettings class. It is part of the Engine module, as evidenced by the file paths in the provided code references.
The value of AllWaveFormats is set in the ReadConfiguration function of the FAudioFormatSettings class. It is populated either from a configuration file (using InConfigSystem->GetArray) or defaults to a predefined set of formats if not specified in the configuration.
AllWaveFormats interacts with several other variables within the FAudioFormatSettings class, including:
- WaveFormatModuleHints
- PlatformFormat
- PlatformStreamingFormat
- FallbackFormat
Developers should be aware of the following when using this variable:
- The order of formats in AllWaveFormats matters, as the first format is used as a fallback if other format selections are invalid.
- It’s used to validate other format selections (PlatformFormat, PlatformStreamingFormat, FallbackFormat) to ensure they are supported.
- Changes to this variable can affect the entire audio pipeline in the engine.
Best practices when using this variable include:
- Ensure that all necessary audio formats for your project are included in the AllWaveFormats list.
- When adding custom audio formats, make sure to update AllWaveFormats accordingly.
- Be cautious when modifying this list, as it can impact audio playback across the entire project.
- Use the configuration file to set AllWaveFormats rather than hardcoding values, allowing for easier platform-specific customization.
- Always verify that your chosen PlatformFormat, PlatformStreamingFormat, and FallbackFormat are included in AllWaveFormats to avoid potential runtime issues.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:1550, section: [Audio]
- INI Section:
Audio
- Raw value:
BINKA
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:1551, section: [Audio]
- INI Section:
Audio
- Raw value:
RADA
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:1552, section: [Audio]
- INI Section:
Audio
- Raw value:
ADPCM
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:1553, section: [Audio]
- INI Section:
Audio
- Raw value:
PCM
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:1554, section: [Audio]
- INI Section:
Audio
- Raw value:
OPUS
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:1555, section: [Audio]
- INI Section:
Audio
- Raw value:
OGG
- Is Array:
True
#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:25
Scope (from outer to inner):
file
namespace Audio
class class FAudioFormatSettings
Source code excerpt:
ENGINE_API void ReadConfiguration(FConfigCacheIni*, const FString& InConfigFilename, const FString& InPlatformIdentifierForLogging);
TArray<FName> AllWaveFormats;
TArray<FName> WaveFormatModuleHints;
FName PlatformFormat;
FName PlatformStreamingFormat;
FName FallbackFormat;
};
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioFormatSettings.cpp:78
Scope (from outer to inner):
file
namespace Audio
function void FAudioFormatSettings::GetAllWaveFormats
Source code excerpt:
void FAudioFormatSettings::GetAllWaveFormats(TArray<FName>& OutFormats) const
{
OutFormats = AllWaveFormats;
}
void FAudioFormatSettings::GetWaveFormatModuleHints(TArray<FName>& OutHints) const
{
OutHints = WaveFormatModuleHints;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioFormatSettings.cpp:97
Scope (from outer to inner):
file
namespace Audio
function void FAudioFormatSettings::ReadConfiguration
Source code excerpt:
using namespace Audio;
// AllWaveFormats.
{
TArray<FString> FormatNames;
if (InConfigSystem->GetArray(TEXT("Audio"), TEXT("AllWaveFormats"), FormatNames, InConfigFilename))
{
Algo::Transform(FormatNames, AllWaveFormats, ToFName);
}
else
{
AllWaveFormats = { NAME_BINKA, NAME_ADPCM, NAME_PCM, NAME_OPUS, NAME_RADA};
UE_LOG(LogAudio, Warning, TEXT("Audio:AllWaveFormats is not defined, defaulting to built in formats. (%s)"), *MakePrettyArrayToString(AllWaveFormats));
}
}
// FormatModuleHints
{
TArray<FString> FormatModuleHints;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioFormatSettings.cpp:132
Scope (from outer to inner):
file
namespace Audio
function void FAudioFormatSettings::ReadConfiguration
Source code excerpt:
UE_LOG(LogAudio, Warning, TEXT("Audio:FallbackFormat is not defined, defaulting to '%s'."), *FallbackFormat.GetPlainNameString());
}
if (!AllWaveFormats.Contains(FallbackFormat) && AllWaveFormats.Num() > 0)
{
UE_LOG(LogAudio, Warning, TEXT("FallbackFormat '%s' not defined in 'AllWaveFormats'. Using first format listed '%s'"), *FallbackFormatString, *AllWaveFormats[0].ToString());
FallbackFormat = AllWaveFormats[0];
}
}
// PlatformFormat
{
FString PlatformFormatString;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioFormatSettings.cpp:151
Scope (from outer to inner):
file
namespace Audio
function void FAudioFormatSettings::ReadConfiguration
Source code excerpt:
UE_LOG(LogAudio, Warning, TEXT("Audio:PlatformFormat is not defined, defaulting to '%s'."), *PlatformFormat.GetPlainNameString());
}
if (!AllWaveFormats.Contains(PlatformFormat))
{
UE_LOG(LogAudio, Warning, TEXT("PlatformFormat '%s' not defined in 'AllWaveFormats'. Using fallback format '%s'"), *PlatformFormatString, *FallbackFormat.ToString());
PlatformFormat = FallbackFormat;
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioFormatSettings.cpp:170
Scope (from outer to inner):
file
namespace Audio
function void FAudioFormatSettings::ReadConfiguration
Source code excerpt:
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