au.SoundWaveImportLengthLimitInSeconds
au.SoundWaveImportLengthLimitInSeconds
#Overview
name: au.SoundWaveImportLengthLimitInSeconds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When set to a value > 0.0f, Soundwaves with durations greater than the value will fail to import.\nif the value is < 0.0f, the length will be unlimited
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.SoundWaveImportLengthLimitInSeconds is to limit the duration of sound waves that can be imported into Unreal Engine. It is part of the audio system, specifically the sound import functionality.
This setting variable is primarily used by the Audio Editor module of Unreal Engine, as evidenced by its location in the SoundFactory.cpp file within the AudioEditor source directory.
The value of this variable is set using a console variable (CVar) system. It’s initialized to -1.0f and can be modified at runtime or through configuration files.
The associated variable SoundWaveImportLengthLimitInSecondsCVar directly interacts with au.SoundWaveImportLengthLimitInSeconds. They share the same value, with SoundWaveImportLengthLimitInSecondsCVar being the actual storage for the setting.
Developers must be aware that:
- When set to a value greater than 0.0f, it will cause the import of sound waves longer than the specified duration to fail.
- If the value is less than 0.0f (default -1.0f), there is no limit on the sound wave duration.
Best practices when using this variable include:
- Set it to a reasonable value to prevent accidentally importing extremely large audio files that could impact performance or storage.
- Consider project requirements when setting this limit, balancing between allowing necessary long audio and preventing problematic imports.
- Document the chosen limit for the team to understand the constraint.
Regarding the associated variable SoundWaveImportLengthLimitInSecondsCVar:
- Its purpose is to store the actual value of the au.SoundWaveImportLengthLimitInSeconds setting.
- It’s used in the Sound Factory to check if a sound wave being imported exceeds the specified duration limit.
- The value is set through the CVar system, allowing for runtime modification.
- It directly interacts with au.SoundWaveImportLengthLimitInSeconds, serving as its storage mechanism.
- Developers should be aware that modifying this variable directly is not recommended; instead, they should use the CVar system to change au.SoundWaveImportLengthLimitInSeconds.
- Best practice is to treat this as a read-only variable in code, relying on the CVar system for modifications.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/AudioEditor/Private/Factories/SoundFactory.cpp:39
Scope: file
Source code excerpt:
static float SoundWaveImportLengthLimitInSecondsCVar = -1.f;
FAutoConsoleVariableRef CVarSoundWaveImportLengthLimitInSeconds(
TEXT("au.SoundWaveImportLengthLimitInSeconds"),
SoundWaveImportLengthLimitInSecondsCVar,
TEXT("When set to a value > 0.0f, Soundwaves with durations greater than the value will fail to import.\n")
TEXT("if the value is < 0.0f, the length will be unlimited"),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named SoundWaveImportLengthLimitInSecondsCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/AudioEditor/Private/Factories/SoundFactory.cpp:37
Scope: file
Source code excerpt:
ECVF_Default);
static float SoundWaveImportLengthLimitInSecondsCVar = -1.f;
FAutoConsoleVariableRef CVarSoundWaveImportLengthLimitInSeconds(
TEXT("au.SoundWaveImportLengthLimitInSeconds"),
SoundWaveImportLengthLimitInSecondsCVar,
TEXT("When set to a value > 0.0f, Soundwaves with durations greater than the value will fail to import.\n")
TEXT("if the value is < 0.0f, the length will be unlimited"),
ECVF_Default);
namespace
#Loc: <Workspace>/Engine/Source/Editor/AudioEditor/Private/Factories/SoundFactory.cpp:612
Scope (from outer to inner):
file
function UObject* USoundFactory::CreateObject
Source code excerpt:
Sound->TotalSamples = *WaveInfo.pSamplesPerSec * Sound->Duration;
const bool bLimitingSoundWaveLength = SoundWaveImportLengthLimitInSecondsCVar > 0.0f;
if (bLimitingSoundWaveLength && Sound->Duration >= SoundWaveImportLengthLimitInSecondsCVar)
{
FMessageDialog::Open(EAppMsgType::Ok, FText::Format(NSLOCTEXT("SoundFactory", "Soundwave is too long to import"
, "{0} is {1} seconds in duration (this is over the limit of {2} seconds) {3}")
, FText::FromString(CuePackageName), Sound->Duration, SoundWaveImportLengthLimitInSecondsCVar, Reason));
GEditor->GetEditorSubsystem<UImportSubsystem>()->BroadcastAssetPostImport(this, nullptr);
return nullptr;
}
// Store the current file path and timestamp for re-import purposes