USoundWave

Windows
MacOS
Linux

Inheritance Hierarchy

Syntax

class USoundWave : public USoundBase

Variables

Name Description

Public variable

UAssetImportDat...

 

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

 

bIsBeginDestroy

Whether this sound wave is beginning to be destroyed by GC.

Public variable

uint8: 1

 

bIsBus

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

uint32: 1

 

bNeedsThumbnailGeneration

Public variable

uint8: 1

 

bProcedural

Set to true for programmatically-generated, streamed audio.

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

Whether this sound can be streamed to avoid increased memory usage

Public variable

uint8: 1

 

bVirtualizeWhenSilent

Allows sound to continue playing when silent.

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

FFormatContaine...

 

CompressedFormatData

Public variable

int32

 

CompressionQuality

Platform agnostic compression quality.

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.

Protected variable

UCurveTable ...

 

Curves

Curves associated with this sound wave

Public variable

TEnumAsByte< en...

 

DecompressionType

Type of buffer this wave uses. Set once on load

Public variable

int32

 

EnvelopeFollowerAttackTime

How quickly the envelope analyzer responds to increasing amplitudes.

Public variable

int32

 

EnvelopeFollowerFrameSize

How many audio frames to average a new envelope value.

Public variable

int32

 

EnvelopeFollowerReleaseTime

How quickly the envelope analyzer responds to decreasing amplitudes.

Public variable

int32

 

FFTAnalysisFrameSize

How many audio frames analyze at a time.

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

UCurveTable ...

 

InternalCurves

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

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

float

 

Pitch

Playback pitch for sound.

Public variable

FByteBulkData

 

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 readonly 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

uint8 *

 

ResourceData

Memory containing the data copied from the compressed bulk data

Public variable

int32

 

ResourceID

Resource index to cross reference with buffers

Public variable

int32

 

ResourceSize

Size of resource copied from the bulk data

Public variable

FStreamedAudioP...

 

RunningPlatformData

The streaming derived data for this sound on this platform.

Protected variable

int32

 

SampleRate

Cached sample rate for displaying in the tools

Public variable

ESoundwaveSampl...

 

SampleRateQuality

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

Public variable

TEnumAsByte< ES...

 

SoundGroup

Public variable

FString

 

SpokenText

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

Public variable

int32

 

StreamingPriority

Priority of this sound when streaming (lower priority streams may not always play)

Public variable

float

 

SubtitlePriority

The priority of the subtitle.

Public variable

TArray< struct ...

 

Subtitles

Subtitle cues.

Public variable

int32

 

TrackedMemoryUsage

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

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

 

BeginCachePlatformData()

Begins caching platform data in the background.

Public function Virtual

void

 

BeginGetCompressedData

(
    FName Format,
    const FPlatformAudioCookOverrides&...
)

Public function

void

 

CachePlatformData

(
    bool bAsyncCache
)

Caches platform data for the sound.

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

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

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

int32

 

GetCompressedDataSize

(
    FName Format,
    const FPlatformAudioCookOverrides&...
)

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

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

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

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 Static

const FPlatf...

 

GetPlatformCompressionOverridesForCurrentPlatform()

Return the platform compression overrides set for the current platform.

Public function Const

ESoundWavePr...

 

GetPrecacheState()

Public function Virtual

int32

 

GetResourceSizeForFormat

(
    FName Format
)

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

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

 

HasInternalCurves()

Returns whether this sound wave has internal curves.

Public function Virtual

void

 

InitAudioResource

(
    FByteBulkData& CompressedData
)

Copy the compressed audio data from the bulk data

Public function Virtual

bool

 

InitAudioResource

(
    FName Format
)

Copy the compressed audio data from derived data cache

Public function

void

 

InvalidateCompressedData()

Change the guid and flush all compressed data

Public function Const

bool

 

IsGenerating()

Public function Const

bool

 

IsStreaming

(
    const FPlatformAudioCookOverrides&...
)

Checks whether sound has been categorised as streaming.

Public function

void

 

LogSubtitle

(
    FOutputDevice& Ar
)

Prints the subtitle associated with the SoundWave to the console

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

void

 

RemoveAudioResource()

Remove the compressed audio data associated with the passed in wave

Public function

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

 

SetGenerating

(
    bool bInGenerating
)

Public function

void

 

SetInternalCurveData

(
    UCurveTable* InCurves
)

Sets the internal curve data for this sound wave.

Public function

void

 

SetPrecacheState

(
    ESoundWavePrecacheState InState
)

Public function

void

 

SetSampleRate

(
    uint32 InSampleRate
)

Overwrite sample rate.

Public function

void

 

UpdatePlatformData()

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

Overridden from USoundBase

Name Description

Public function Virtual Const

UCurveTable ...

 

GetCurveData()

Returns curves associated with this sound wave

Public function Virtual

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

 

IsAllowedVirtual()

Returns whether a sound is allowed to be virtualized.

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.

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)

Enums

Name

Description

Private enum

ESoundWaveResourceState

Typedefs

Name

Description

FAsyncAudioDecompress

Async worker that decompresses the audio data on a different thread

Deprecated Variables

Name Description

Public variable

FString

 

SourceFilePath_DEPRECATED

Public variable

FString

 

SourceFileTimestamp_DEPRECATED

References

Module

Engine

Header

Runtime/Engine/Classes/Sound/SoundWave.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback