USoundWave

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Sound/SoundWave.h

Include

#include "Sound/SoundWave.h"

Syntax

class USoundWave :
    public USoundBase,
    public IAudioProxyDataFactory,
    public IInterface_AsyncCompilation

Variables

Name Description

Public variable

TObjectPtr< cla...

 

AssetImportData

Public variable

TMap< FName, ui...

 

AsyncLoadingDataFormats

Public variable

FAsyncAudioDeco...

 

AudioDecompressor

Public variable

uint8: 1

 

bCanProcessAsync

Set to true for procedural waves that can be processed asynchronously.

Public variable

uint8: 1

 

bDecompressedFromOgg

Whether this SoundWave was decompressed from OGG.

Public variable

uint8: 1

 

bDynamicResource

Whether to free the resource data after it has been uploaded to the hardware

Public variable

uint8: 1

 

bEnableAmplitudeEnvelopeAnalysis

Whether or not to enable cook-time amplitude envelope analysis.

Public variable

uint8: 1

 

bEnableBakedFFTAnalysis

Whether or not to enable cook-time baked FFT analysis.

Public variable

uint8: 1

 

bIsAmbisonics

Whether or not this source is ambisonics file format.

Public variable

uint8: 1

 

bIsSourceBus

Set to true of this is a bus sound source.

Public variable

uint8: 1

 

bLooping

If set, when played directly (not through a sound cue) the wave will be played looping.

Public variable

uint8: 1

 

bManualWordWrap

If set to true will disable automatic generation of line breaks - use if the subtitles have been split manually.

Public variable

uint8: 1

 

bMature

If set to true if this sound is considered to contain mature/adult content.

Public variable

uint8: 1

 

bProcedural

Set to true for programmatically generated audio.

Public variable

uint8: 1

 

bRequiresStopFade

Set to true if fade is required when sound is abruptly stopped.

Public variable

uint8: 1

 

bSingleLine

If set to true the subtitles display as a sequence of single lines as opposed to multiline.

Public variable

uint8: 1

 

bStreaming

Here for legacy code.

Public variable

uint8 *

 

CachedRealtimeFirstBuffer

Pointer to 16 bit PCM data - used to avoid synchronous operation to obtain first block of the realtime decompressed buffer

Public variable

TArray< int32 >

 

ChannelOffsets

Offsets into the bulk data for the source wav data

Public variable

TArray< int32 >

 

ChannelSizes

Sizes of the bulk data for the source wav data

Public variable

FString

 

Comment

Provides contextual information for the sound to the translator.

Public variable

FGuid

 

CompressedDataGuid

GUID used to uniquely identify this node so it can be found in the DDC

Public variable

TArray< FSoundW...

 

CookedEnvelopeTimeData

The cooked cooked envelope data.

Public variable

TSortedMap< FSt...

 

CookedPlatformData

Cooked streaming platform data for this sound

Public variable

TArray< FSoundW...

 

CookedSpectralTimeData

The cooked spectral time data.

Public variable

TArray< FSoundW...

 

CuePoints

Cue point data parsed fro the .wav file. Contains "Loop Regions" as cue points as well!

Public variable

TSharedPtr< FTh...

 

CurrentChunkRevision

The current revision of our compressed audio data. Used to tell when a chunk in the cache is stale.

Protected variable

TObjectPtr< cla...

 

Curves

Curves associated with this sound wave

Public variable

TEnumAsByte< ED...

 

DecompressionType

Type of buffer this wave uses. Set once on load

Public variable

int32

 

EnvelopeFollowerAttackTime

The attack time in milliseconds.

Public variable

int32

 

EnvelopeFollowerFrameSize

How many audio frames to average a new envelope value.

Public variable

int32

 

EnvelopeFollowerReleaseTime

The release time in milliseconds.

Public variable

int32

 

FFTAnalysisAttackTime

Attack time in milliseconds of the spectral envelope follower.

Public variable

int32

 

FFTAnalysisFrameSize

How many audio frames analyze at a time.

Public variable

int32

 

FFTAnalysisReleaseTime

Release time in milliseconds of the spectral envelope follower.

Public variable

ESoundWaveFFTSi...

 

FFTSize

The FFT window size to use for fft analysis.

Public variable

TArray< float >

 

FrequenciesToAnalyze

The frequencies (in hz) to analyze when doing baked FFT analysis.

Protected variable

int32

 

ImportedSampleRate

Sample rate of the imported sound wave.

Public variable

int32

 

InitialChunkSize

Use this to override how much audio data is loaded when this USoundWave is loaded.

Protected variable

TObjectPtr< cla...

 

InternalCurves

Hold a reference to our internal curve so we can switch back to it if we want to

Public variable

ESoundWaveLoadi...

 

LoadingBehavior

Loading behavior members are lazily initialized in const getters.

Public variable

FSoundModulatio...

 

ModulationSettings

Modulation Settings

Public variable

int32

 

NumChannels

Number of channels of multichannel data; 1 or 2 for regular mono and stereo files

Public variable

int32

 

NumPrecacheFrames

The number of frames which have been precached for this sound wave.

Public variable

FThreadSafeCoun...

 

NumSourcesPlaying

The number of sounds currently playing this sound wave.

Public variable

TObjectPtr< USo...

 

OverrideSoundToUseForAnalysis

Specify a sound to use for the baked analysis.

Public variable

float

 

Pitch

Playback pitch for sound.

Public variable

UE::Serializati...

 

RawData

Uncompressed wav data 16 bit in mono or stereo - stereo not allowed for multichannel data

Public variable

FCriticalSectio...

 

RawDataCriticalSection

FByteBulkData doesn't currently support read-only access from multiple threads, so we limit access to RawData with a critical section on cook.

Public variable

uint8 *

 

RawPCMData

Pointer to 16 bit PCM data - used to decompress data to and preview sounds

Public variable

int32

 

RawPCMDataSize

Size of RawPCMData, or what RawPCMData would be if the sound was fully decompressed

Public variable

int32

 

ResourceID

Resource index to cross reference with buffers

Protected variable

int32

 

SampleRate

Cooked sample rate of the asset. Can be modified by sample rate override.

Public variable

ESoundwaveSampl...

 

SampleRateQuality

Quality of sample rate conversion for platforms that opt into resampling during cook.

Public variable

TEnumAsByte< ES...

 

SoundGroup

Public variable

TSharedPtr< FSo...

 

SoundWaveDataPtr

Public variable

int32

 

StreamingPriority

Public variable

float

 

SubtitlePriority

The priority of the subtitle.

Public variable

TArray< struct ...

 

Subtitles

Subtitle cues.

Public variable

FSoundWaveTimec...

 

TimecodeInfo

Information about the time-code from import, if available.

Public variable

int32

 

TrackedMemoryUsage

Cache the total used memory recorded for this SoundWave to keep INC/DEC consistent

Public variable

TArray< TObject...

 

Transformations

Waveform edits to be applied to this SoundWave on cook (editing transformations will trigger a cook)

Public variable

uint8: 1

 

TreatFileAsLoopingForAnalysis

Whether or not we should treat the sound wave used for analysis (this or the override) as looping while performing analysis.

Public variable

float

 

Volume

Playback volume of sound 0 to 1 - Default is 1.0.

Constructors

Name Description

Public function

USoundWave

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

AddPlayingSource()

Public function

void

 

AddPlayingSource

(
    const FSoundWaveClientPtr& Source
)

Public function Virtual

void

 

BeginCachePlatformData()

Begins caching platform data in the background.

Public function Virtual

void

 

BeginGetCompressedData

(
    FName Format,
    const FPlatformAudioCookOverrides&...
)

Public function Virtual

void

 

CachePlatformData

(
    bool bAsyncCache
)

Caches platform data for the sound.

Public function Virtual Const

bool

 

CanVisualizeAsset()

Public function

void

 

CleanupCachedRunningPlatformData()

Public function

bool

 

CleanupDecompressor

(
    bool bForceCleanup
)

Will clean up the decompressor task if the task has finished or force it finish.

Public function

FSoundWavePr...

 

CreateSoundWaveProxy()

Public function Const

TArray< Audi...

 

CreateTransformations()

Public function Virtual

void

 

FinishCachePlatformData()

Blocks on async cache tasks and prepares platform data for use.

Public function

void

 

ForceRebuildPlatformData()

Forces platform data to be rebuilt.

Public function

void

 

FreeResources

(
    bool bStopSoundsUsingThisResource
)

Frees up all the resources allocated in this class.

Public function Virtual

int32

 

GeneratePCMData

(
    uint8* PCMData,
    const int32 SamplesNeeded
)

This is only used for DTYPE_Procedural audio.

Public function

bool

 

GetChunkData

(
    int32 ChunkIndex,
    uint8** OutChunkData,
    bool bMakeSureChunkIsLoaded
)

Get Chunk data for a specified chunk index.

Public function Virtual

FByteBulkDat...

 

GetCompressedData

(
    FName Format,
    const FPlatformAudioCookOverrides&...
)

Gets the compressed data from derived data cache for the specified platform Warning, the returned pointer isn't valid after we add new formats

Public function

SIZE_T

 

GetCompressedDataSize

(
    FName Format,
    const FPlatformAudioCookOverrides&...
)

Gets the compressed data size from derived data cache for the specified format

Public function Const

int32

 

GetCompressionQuality()

Returns the compression quality of the sound asset.

Public function Const

TArray< FSou...

 

GetCuePoints()

Filters for the cue points that are not loop regions and returns those as a new array

Public function Static

FName

 

GetCurvePropertyName()

Gets the member name for the Curves property of the USoundWave object.

Public function Virtual Const

Audio::EAudi...

 

GetGeneratedPCMDataFormat()

Return the format of the generated PCM data type.

Public function

void

 

GetHandleForChunkOfAudio

(
    TFunction< void(FAudioChunkHandle&...,
    bool bForceSync,
    int32 ChunkIndex,
    ENamedThreads::Type CallbackThread
)

If stream caching is enabled, allows the user to retain a strong handle to the first chunk of audio in the cache.

Public function Const

bool

 

GetImportedSoundWaveData

(
    TArray< uint8 >& OutRawPCMData,
    uint32& OutSampleRate,
    uint16& OutNumChannels
)

Utility which returns imported PCM data and the parsed header for the file.

Public function Const

bool

 

GetImportedSoundWaveData

(
    TArray< uint8 >& OutRawPCMData,
    uint32& OutSampleRate,
    TArray< EAudioSpeakers >& OutChann...
)

Utility which returns imported PCM data and the parsed header for the file.

Public function Const

UCurveTable ...

 

GetInternalCurveData()

These functions are required for support for some custom details/editor functionality.

Public function

bool

 

GetInterpolatedCookedEnvelopeDataForTime

(
    float InTime,
    uint32& InOutLastIndex,
    float& OutAmplitude,
    bool bLoop
)

Public function

bool

 

GetInterpolatedCookedFFTDataForTime

(
    float InTime,
    uint32& InOutLastIndex,
    TArray< FSoundWaveSpectralData >& ...,
    bool bLoop
)

Helper function to get interpolated cooked FFT data for a given time value.

Public function Const

ESoundWaveLo...

 

GetLoadingBehavior

(
    bool bCheckSoundClasses
)

Returns the loading behavior we should use for this sound wave.

Public function Const

TArray< FSou...

 

GetLoopRegions()

Filters for the cue points that are loop regions and returns those as a new array

Public function Const

uint32

 

GetNumChunks()

Returns the amount of chunks this soundwave contains if it's streaming, or zero if it is not a streaming source.

Public function Static

const FPlatf...

 

GetPlatformCompressionOverridesForCurrentPlatform()

Return the platform compression overrides set for the current platform.

Public function Static

FName

 

GetPlatformSpecificFormat

(
    FName Format,
    const FPlatformAudioCookOverrides&...
)

Public function Const

ESoundWavePr...

 

GetPrecacheState()

Public function Virtual Const

bool

 

GetRedrawThumbnail()

Public function Const

const uint8 ...

 

GetResourceData()

Memory containing the data copied from the compressed bulk data

Public function Const

int32

 

GetResourceSize()

Public function Virtual

int32

 

GetResourceSizeForFormat

(
    FName Format
)

Public function Static

ITargetPlatf...

 

GetRunningPlatform()

Helper function for getting the cached name of the current platform.

Public function Const

FName

 

GetRuntimeFormat()

Returns the Runtime format of the wave

Public function

float

 

GetSampleRateForCompressionOverrides

(
    const FPlatformAudioCookOverrides&...
)

Returns a sample rate if there is a specific sample rate override for this platform, -1.0 otherwise.

Public function Const

float

 

GetSampleRateForCurrentPlatform()

Returns a sample rate if there is a specific sample rate override for this platform, -1.0 otherwise.

Public function

float

 

GetSampleRateForTargetPlatform

(
    const ITargetPlatform* TargetP...
)

Returns a sample rate if there is a specific sample rate override for this platform, -1.0 otherwise.

Public function

uint32

 

GetSizeOfChunk

(
    uint32 ChunkIndex
)

Public function Const

ESoundAssetC...

 

GetSoundAssetCompressionType()

Returns the sound's asset compression type.

Public function Const

ESoundAssetC...

 

GetSoundAssetCompressionTypeEnum()

Will return the raw value, (i.e. does not resolve options such as "Project Defined" to the correct codec)

Public function Const

TOptional< F...

 

GetTimecodeInfo()

Public function Const

const FWaveT...

 

GetTransformationChainConfig()

Public function

TArrayView< ...

 

GetZerothChunk

(
    bool bForImmediatePlayback
)

This returns the initial chunk of compressed data for streaming data sources.

Public function Const

FWaveInstanc...

 

HandleStart

(
    FActiveSound& ActiveSound,
    const UPTRINT WaveInstanceHash
)

Handle any special requirements when the sound starts (e.g. subtitles)

Public function Virtual Const

bool

 

HasCompressedData

(
    FName Format,
    ITargetPlatform* TargetPlatfor...
)

Public function Const

bool

 

HasError()

Public function Const

bool

 

HasInternalCurves()

Returns whether this sound wave has internal curves.

Public function

bool

 

HasStreamingChunks()

This function returns true if there are streamable chunks in this asset.

Public function Virtual

bool

 

InitAudioResource

(
    FName Format
)

Copy the compressed audio data from derived data cache

Public function Virtual

void

 

InitAudioResource

(
    FByteBulkData& CompressedData
)

Copy the compressed audio data from the bulk data

Public function

void

 

InvalidateCompressedData

(
    bool bFreeResources,
    bool bRebuildStreamingChunks
)

Change the guid and flush all compressed data

Public function

void

 

InvalidateSoundWaveIfNeccessary()

This function can be called before playing or using a SoundWave to check if any cook settings have been modified since this SoundWave was last cooked.

Public function Const

bool

 

IsAsyncWorkComplete()

IInterface_AsyncCompilation end

Public function Const

bool

 

IsCompressedDataReady

(
    FName Format,
    const FPlatformAudioCookOverrides&...
)

Returns if an async task for a certain platform has finished.

Public function Const

bool

 

IsGeneratingAudio()

Public function Const

bool

 

IsLoadedFromCookedData()

Public function

bool

 

IsRetainingAudio()

Public function Virtual Const

bool

 

IsSeekable()

Returns whether the sound is seekable.

Public function Const

bool

 

IsStreaming

(
    const TCHAR* PlatformName
)

Checks whether sound has been categorized as streaming.

Public function Const

bool

 

IsStreaming

(
    const FPlatformAudioCookOverrides&...
)

Checks whether sound has been categorized as streaming.

Public function

bool

 

LoadZerothChunk()

Returns true if the zeroth chunk is loaded, or attempts to load it if not already loaded, returning true if the load was successful.

Public function

void

 

LogBakedData()

Public function Virtual

void

 

OnBeginGenerate()

Called when the procedural sound wave begins on the render thread. Only used in the audio mixer and when bProcedural is true.

Public function Virtual

void

 

OnEndGenerate()

Called when the procedural sound wave is done generating on the render thread. Only used in the audio mixer and when bProcedural is true..

Public function Virtual

void

 

OnEndGenerate

(
    ISoundGeneratorPtr Generator
)

Public function

void

 

OverrideLoadingBehavior

(
    ESoundWaveLoadingBehavior InLoading...
)

If Stream Caching is enabled, this can be used to override the default loading behavior of this USoundWave.

Public function

void

 

PostImport()

Public function

void

 

ReleaseCompressedAudio()

If stream caching is enabled and au.streamcache.KeepFirstChunkInMemory is 1, this will release this USoundWave's first chunk, allowing it to be deleted.

Public function

void

 

RemoveAudioResource()

Remove the compressed audio data associated with the passed in wave

Public function

void

 

RemovePlayingSource()

Public function

void

 

RemovePlayingSource

(
    const FSoundWaveClientPtr& Source
)

Public function

void

 

ResetError()

Public function

void

 

RetainCompressedAudio

(
    bool bForceSync
)

If stream caching is enabled, set this sound wave to retain a strong handle to its first chunk.

Public function Virtual

void

 

SerializeCookedPlatformData

(
    FArchive& Ar
)

Serializes cooked platform data.

Public function

void

 

SetCurveData

(
    UCurveTable* InCurves
)

Sets the curve data for this sound wave.

Public function

void

 

SetError

(
    const TCHAR* InErrorMsg
)

Public function

void

 

SetImportedSampleRate

(
    uint32 InImportedSampleRate
)

Public function

void

 

SetInternalCurveData

(
    UCurveTable* InCurves
)

Sets the internal curve data for this sound wave.

Public function

void

 

SetPrecacheState

(
    ESoundWavePrecacheState InState
)

Public function Virtual

void

 

SetRedrawThumbnail

(
    bool bInRedraw
)

Public function

void

 

SetSampleRate

(
    uint32 InSampleRate
)

Overwrite sample rate.

Public function

void

 

SetSoundAssetCompressionType

(
    ESoundAssetCompressionType InSoundA...,
    bool bMarkDirty
)

Procedurally set the compression type.

Public function

void

 

SetTimecodeInfo

(
    const FSoundWaveTimecodeInfo& InTi...
)

Public function Const

bool

 

ShouldUseStreamCaching()

Checks whether we should use the load on demand cache.

Public function

void

 

UpdatePlatformData()

Attempts to update the cached platform data after any changes that might affect it

Public function

const FWaveT...

 

UpdateTransformations()

Overridden from USoundBase

Name Description

Public function Virtual Const

UCurveTable ...

 

GetCurveData()

Returns curves associated with this sound wave

Public function Virtual Const

float

 

GetDuration()

Returns the length of the sound

Public function Virtual

bool

 

GetSoundWavesWithCookedAnalysisData

(
    TArray< USoundWave* >& OutSou...
)

Returns whether the sound has cooked analysis data (e.g. FFT or envelope following data) and returns sound waves which have cooked data.

Public function Virtual Const

float

 

GetSubtitlePriority()

Returns the subtitle priority

Public function Virtual Const

bool

 

HasCookedAmplitudeEnvelopeData()

Public function Virtual Const

bool

 

HasCookedFFTData()

Queries if the sound has cooked FFT or envelope data.

Public function Virtual Const

bool

 

IsPlayable()

Returns whether the sound base is set up in a playable manner

Public function Virtual

void

 

Parse

(
    FAudioDevice* AudioDevice,
    const UPTRINT NodeWaveInstanceHash,
    FActiveSound& ActiveSound,
    const FSoundParseParameters& Parse...,
    TArray< FWaveInstance* >& Wav...
)

Parses the Sound to generate the WaveInstances to play.

Public function Virtual Const

bool

 

SupportsSubtitles()

Returns whether sound supports subtitles.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginCacheForCookedPlatformData

(
    const ITargetPlatform* TargetP...
)

Begins caching platform data in the background for the platform requested

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

void

 

ClearAllCachedCookedPlatformData()

Clear all the cached cooked platform data which we have accumulated with BeginCacheForCookedPlatformData calls The data can still be cached again using BeginCacheForCookedPlatformData again

Public function Virtual

void

 

ClearCachedCookedPlatformData

(
    const ITargetPlatform* TargetP...
)

Clears cached cooked platform data for specific platform

Public function Virtual

void

 

FinishDestroy()

Called to finish destroying the object.

Public function Virtual Const

void

 

GetAssetRegistryTags

(
    TArray< FAssetRegistryTag >& OutTa...
)

Gathers a list of asset registry searchable tags which are name/value pairs with some type information This only needs to be implemented for asset objects

Public function Virtual

FString

 

GetDesc()

Return a one line description of an object for viewing in the thumbnail view of the generic browser

Public function Virtual

FName

 

GetExporterName()

Returns the name of the exporter factory used to export this object Used when multiple factories have the same extension

Public function Virtual

void

 

GetResourceSizeEx

(
    FResourceSizeEx& CumulativeResourc...
)

Get the size of the object/resource for use in memory tools or to display to artists/LDs in the Editor This is the extended version which separates up the used memory into different memory regions (the actual definition of which may be platform specific).

Public function Virtual

bool

 

IsCachedCookedPlatformDataLoaded

(
    const ITargetPlatform* TargetP...
)

Have we finished loading all the cooked platform data for the target platforms requested in BeginCacheForCookedPlatformData

Public function Virtual

bool

 

IsReadyForFinishDestroy()

Called to check if the object is ready for FinishDestroy.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Public function Virtual

void

 

WillNeverCacheCookedPlatformDataAgain()

All caching has finished for this object (all IsCachedCookedPlatformDataLoaded functions have finished for all platforms)

Overridden from IAudioProxyDataFactory

Name Description

Public function Virtual

TSharedPtr< ...

 

CreateProxyData

(
    const Audio::FProxyDataInitParams&...
)

Overridden from IInterface_AsyncCompilation

Name Description

Public function Virtual Const

bool

 

IsCompiling()

IInterface_AsyncCompilation begin

Enums

Name

Description

Private enum

ESoundWaveResourceState

Typedefs

Name

Description

FAsyncAudioDecompress

Async worker that decompresses the audio data on a different thread

FSoundWaveClientPtr

Deprecated Variables

Name Description

Public variable

uint8: 1

 

bVirtualizeWhenSilent_DEPRECATED

Public variable

FString

 

SourceFilePath_DEPRECATED

Public variable

FString

 

SourceFileTimestamp_DEPRECATED

Public variable

FString

 

SpokenText_DEPRECATED

A localized version of the text that is actually spoken phonetically in the audio.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Cancel