Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/Sound
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- USoundBase
- USoundWave
- USoundSourceBus
- USoundWaveProcedural
- UMetaSoundSource
- USoundModWave
- USynthSound
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
| Type | Name | Description | |
|---|---|---|---|
| TObjectPtr< class UAssetImportData > | AssetImportData | ||
| TMap< FName, uint32 > | AsyncLoadingDataFormats | ||
| FAsyncAudioDecompress * | AudioDecompressor | ||
| uint8: 1 | bCanProcessAsync | Set to true for procedural waves that can be processed asynchronously. | |
| uint8: 1 | bDecompressedFromOgg | Whether this SoundWave was decompressed from OGG. | |
| uint8: 1 | bDynamicResource | Whether to free the resource data after it has been uploaded to the hardware | |
| uint8: 1 | bEnableAmplitudeEnvelopeAnalysis | Whether or not to enable cook-time amplitude envelope analysis. | |
| uint8: 1 | bEnableBakedFFTAnalysis | Whether or not to enable cook-time baked FFT analysis. | |
| uint8: 1 | bIsAmbisonics | Whether or not this source is ambisonics file format. | |
| uint8: 1 | bIsSourceBus | Set to true of this is a bus sound source. | |
| uint8: 1 | bLooping | If set, when played directly (not through a sound cue) the wave will be played looping. | |
| uint8: 1 | bManualWordWrap | If set to true will disable automatic generation of line breaks - use if the subtitles have been split manually. | |
| uint8: 1 | bMature | If set to true if this sound is considered to contain mature/adult content. | |
| uint8: 1 | bProcedural | Set to true for programmatically generated audio. | |
| uint8: 1 | bRequiresStopFade | Set to true if fade is required when sound is abruptly stopped. | |
| uint8: 1 | bSingleLine | If set to true the subtitles display as a sequence of single lines as opposed to multiline. | |
| uint8: 1 | bStreaming | Here for legacy code. | |
| uint8 * | CachedRealtimeFirstBuffer | Pointer to 16 bit PCM data - used to avoid synchronous operation to obtain first block of the realtime decompressed buffer | |
| TArray< int32 > | ChannelOffsets | Offsets into the bulk data for the source wav data | |
| TArray< int32 > | ChannelSizes | Sizes of the bulk data for the source wav data | |
| FString | Comment | Provides contextual information for the sound to the translator. | |
| FGuid | CompressedDataGuid | GUID used to uniquely identify this node so it can be found in the DDC | |
| TArray< FSoundWaveEnvelopeTimeData > | CookedEnvelopeTimeData | The cooked cooked envelope data. | |
| TSortedMap< FString, FStreamedAudioPlatformData * > | CookedPlatformData | Cooked streaming platform data for this sound | |
| TArray< FSoundWaveSpectralTimeData > | CookedSpectralTimeData | The cooked spectral time data. | |
| TArray< FSoundWaveCuePoint > | CuePoints | Cue point data parsed fro the .wav file. Contains "Loop Regions" as cue points as well! | |
| TSharedPtr< FThreadSafeCounter > | CurrentChunkRevision | The current revision of our compressed audio data. Used to tell when a chunk in the cache is stale. | |
| TObjectPtr< class UCurveTable > | Curves | Curves associated with this sound wave | |
| TEnumAsByte< EDecompressionType > | DecompressionType | Type of buffer this wave uses. Set once on load | |
| int32 | EnvelopeFollowerAttackTime | The attack time in milliseconds. | |
| int32 | EnvelopeFollowerFrameSize | How many audio frames to average a new envelope value. | |
| int32 | EnvelopeFollowerReleaseTime | The release time in milliseconds. | |
| int32 | FFTAnalysisAttackTime | Attack time in milliseconds of the spectral envelope follower. | |
| int32 | FFTAnalysisFrameSize | How many audio frames analyze at a time. | |
| int32 | FFTAnalysisReleaseTime | Release time in milliseconds of the spectral envelope follower. | |
| ESoundWaveFFTSize | FFTSize | The FFT window size to use for fft analysis. | |
| TArray< float > | FrequenciesToAnalyze | The frequencies (in hz) to analyze when doing baked FFT analysis. | |
| int32 | ImportedSampleRate | Sample rate of the imported sound wave. | |
| int32 | InitialChunkSize | Use this to override how much audio data is loaded when this USoundWave is loaded. | |
| TObjectPtr< class UCurveTable > | InternalCurves | Hold a reference to our internal curve so we can switch back to it if we want to | |
| ESoundWaveLoadingBehavior | LoadingBehavior | Loading behavior members are lazily initialized in const getters. | |
| FSoundModulationDefaultRoutingSettings | ModulationSettings | Modulation Settings | |
| int32 | NumChannels | Number of channels of multichannel data; 1 or 2 for regular mono and stereo files | |
| int32 | NumPrecacheFrames | The number of frames which have been precached for this sound wave. | |
| FThreadSafeCounter | NumSourcesPlaying | The number of sounds currently playing this sound wave. | |
| TObjectPtr< USoundWave > | OverrideSoundToUseForAnalysis | Specify a sound to use for the baked analysis. | |
| float | Pitch | Playback pitch for sound. | |
| UE::Serialization::FEditorBulkData | RawData | Uncompressed wav data 16 bit in mono or stereo - stereo not allowed for multichannel data | |
| FCriticalSection | RawDataCriticalSection | FByteBulkData doesn't currently support read-only access from multiple threads, so we limit access to RawData with a critical section on cook. | |
| uint8 * | RawPCMData | Pointer to 16 bit PCM data - used to decompress data to and preview sounds | |
| int32 | RawPCMDataSize | Size of RawPCMData, or what RawPCMData would be if the sound was fully decompressed | |
| int32 | ResourceID | Resource index to cross reference with buffers | |
| int32 | SampleRate | Cooked sample rate of the asset. Can be modified by sample rate override. | |
| ESoundwaveSampleRateSettings | SampleRateQuality | Quality of sample rate conversion for platforms that opt into resampling during cook. | |
| TEnumAsByte< ESoundGroup > | SoundGroup | ||
| TSharedPtr< FSoundWaveData, ESPMode::ThreadSafe > | SoundWaveDataPtr | ||
| int32 | StreamingPriority | ||
| float | SubtitlePriority | The priority of the subtitle. | |
| TArray< struct FSubtitleCue > | Subtitles | Subtitle cues. | |
| FSoundWaveTimecodeInfo | TimecodeInfo | Information about the time-code from import, if available. | |
| int32 | TrackedMemoryUsage | Cache the total used memory recorded for this SoundWave to keep INC/DEC consistent | |
| TArray< TObjectPtr< class UWaveformTransformationBase > > | Transformations | Waveform edits to be applied to this SoundWave on cook (editing transformations will trigger a cook) | |
| uint8: 1 | TreatFileAsLoopingForAnalysis | Whether or not we should treat the sound wave used for analysis (this or the override) as looping while performing analysis. | |
| float | Volume | Playback volume of sound 0 to 1 - Default is 1.0. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
USoundWave
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | |||
| void | AddPlayingSource
(
const FSoundWaveClientPtr& Source |
||
| void | Begins caching platform data in the background. | ||
| void | BeginGetCompressedData
(
FName Format, |
||
| void | CachePlatformData
(
bool bAsyncCache |
Caches platform data for the sound. | |
| bool | |||
| void | |||
| bool | CleanupDecompressor
(
bool bForceCleanup |
Will clean up the decompressor task if the task has finished or force it finish. | |
| FSoundWaveProxyPtr | |||
| TArray< Audio::FTransformationPtr > | |||
| void | Blocks on async cache tasks and prepares platform data for use. | ||
| void | Forces platform data to be rebuilt. | ||
| void | FreeResources
(
bool bStopSoundsUsingThisResource |
Frees up all the resources allocated in this class. | |
| int32 | GeneratePCMData
(
uint8* PCMData, |
This is only used for DTYPE_Procedural audio. | |
| bool | GetChunkData
(
int32 ChunkIndex, |
Get Chunk data for a specified chunk index. | |
| FByteBulkData * | GetCompressedData
(
FName Format, |
Gets the compressed data from derived data cache for the specified platform Warning, the returned pointer isn't valid after we add new formats | |
| SIZE_T | GetCompressedDataSize
(
FName Format, |
Gets the compressed data size from derived data cache for the specified format | |
| int32 | Returns the compression quality of the sound asset. | ||
| TArray< FSoundWaveCuePoint > | GetCuePoints () |
Filters for the cue points that are not loop regions and returns those as a new array | |
| FName | Gets the member name for the Curves property of the USoundWave object. | ||
| Audio::EAudioMixerStreamDataFormat::Type | Return the format of the generated PCM data type. | ||
| void | GetHandleForChunkOfAudio
(
TFunction< void(FAudioChunkHandle&&)> OnLoadCompleted, |
If stream caching is enabled, allows the user to retain a strong handle to the first chunk of audio in the cache. | |
| bool | GetImportedSoundWaveData
(
TArray< uint8 >& OutRawPCMData, |
Utility which returns imported PCM data and the parsed header for the file. | |
| bool | GetImportedSoundWaveData
(
TArray< uint8 >& OutRawPCMData, |
Utility which returns imported PCM data and the parsed header for the file. | |
| UCurveTable * | These functions are required for support for some custom details/editor functionality. | ||
| bool | GetInterpolatedCookedEnvelopeDataForTime
(
float InTime, |
||
| bool | GetInterpolatedCookedFFTDataForTime
(
float InTime, |
Helper function to get interpolated cooked FFT data for a given time value. | |
| ESoundWaveLoadingBehavior | GetLoadingBehavior
(
bool bCheckSoundClasses |
Returns the loading behavior we should use for this sound wave. | |
| TArray< FSoundWaveCuePoint > | Filters for the cue points that are loop regions and returns those as a new array | ||
| uint32 | GetNumChunks () |
Returns the amount of chunks this soundwave contains if it's streaming, or zero if it is not a streaming source. | |
| const FPlatformAudioCookOverrides * | Return the platform compression overrides set for the current platform. | ||
| FName | GetPlatformSpecificFormat
(
FName Format, |
||
| ESoundWavePrecacheState | |||
| bool | |||
| const uint8 * | Memory containing the data copied from the compressed bulk data | ||
| int32 | |||
| int32 | GetResourceSizeForFormat
(
FName Format |
||
| ITargetPlatform * | Helper function for getting the cached name of the current platform. | ||
| FName | Returns the Runtime format of the wave | ||
| float | GetSampleRateForCompressionOverrides
(
const FPlatformAudioCookOverrides* CompressionOverrides |
Returns a sample rate if there is a specific sample rate override for this platform, -1.0 otherwise. | |
| float | Returns a sample rate if there is a specific sample rate override for this platform, -1.0 otherwise. | ||
| float | GetSampleRateForTargetPlatform
(
const ITargetPlatform* TargetPlatform |
Returns a sample rate if there is a specific sample rate override for this platform, -1.0 otherwise. | |
| uint32 | GetSizeOfChunk
(
uint32 ChunkIndex |
||
| ESoundAssetCompressionType | Returns the sound's asset compression type. | ||
| ESoundAssetCompressionType | Will return the raw value, (i.e. does not resolve options such as "Project Defined" to the correct codec) | ||
| TOptional< FSoundWaveTimecodeInfo > | |||
| const FWaveTransformUObjectConfiguration & | |||
| TArrayView< const uint8 > | GetZerothChunk
(
bool bForImmediatePlayback |
This returns the initial chunk of compressed data for streaming data sources. | |
| FWaveInstance & | HandleStart
(
FActiveSound& ActiveSound, |
Handle any special requirements when the sound starts (e.g. subtitles) | |
| bool | HasCompressedData
(
FName Format, |
||
| bool | HasError () |
||
| bool | Returns whether this sound wave has internal curves. | ||
| bool | This function returns true if there are streamable chunks in this asset. | ||
| bool | InitAudioResource
(
FName Format |
Copy the compressed audio data from derived data cache | |
| void | InitAudioResource
(
FByteBulkData& CompressedData |
Copy the compressed audio data from the bulk data | |
| void | InvalidateCompressedData
(
bool bFreeResources, |
Change the guid and flush all compressed data | |
| void | 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. | ||
| bool | IInterface_AsyncCompilation end | ||
| bool | IsCompressedDataReady
(
FName Format, |
Returns if an async task for a certain platform has finished. | |
| bool | |||
| bool | |||
| bool | |||
| bool | IsSeekable () |
Returns whether the sound is seekable. | |
| bool | IsStreaming
(
const TCHAR* PlatformName |
Checks whether sound has been categorized as streaming. | |
| bool | IsStreaming
(
const FPlatformAudioCookOverrides& Overrides |
Checks whether sound has been categorized as streaming. | |
| bool | Returns true if the zeroth chunk is loaded, or attempts to load it if not already loaded, returning true if the load was successful. | ||
| void | LogBakedData () |
||
| void | Called when the procedural sound wave begins on the render thread. Only used in the audio mixer and when bProcedural is true. | ||
| void | Called when the procedural sound wave is done generating on the render thread. Only used in the audio mixer and when bProcedural is true.. | ||
| void | OnEndGenerate
(
ISoundGeneratorPtr Generator |
||
| void | OverrideLoadingBehavior
(
ESoundWaveLoadingBehavior InLoadingBehavior |
If Stream Caching is enabled, this can be used to override the default loading behavior of this USoundWave. | |
| void | PostImport () |
||
| void | If stream caching is enabled and au.streamcache.KeepFirstChunkInMemory is 1, this will release this USoundWave's first chunk, allowing it to be deleted. | ||
| void | Remove the compressed audio data associated with the passed in wave | ||
| void | |||
| void | RemovePlayingSource
(
const FSoundWaveClientPtr& Source |
||
| void | ResetError () |
||
| void | RetainCompressedAudio
(
bool bForceSync |
If stream caching is enabled, set this sound wave to retain a strong handle to its first chunk. | |
| void | SerializeCookedPlatformData
(
FArchive& Ar |
Serializes cooked platform data. | |
| void | SetCurveData
(
UCurveTable* InCurves |
Sets the curve data for this sound wave. | |
| void | SetError
(
const TCHAR* InErrorMsg |
||
| void | SetImportedSampleRate
(
uint32 InImportedSampleRate |
||
| void | SetInternalCurveData
(
UCurveTable* InCurves |
Sets the internal curve data for this sound wave. | |
| void | SetPrecacheState
(
ESoundWavePrecacheState InState |
||
| void | SetRedrawThumbnail
(
bool bInRedraw |
||
| void | SetSampleRate
(
uint32 InSampleRate |
Overwrite sample rate. | |
| void | SetSoundAssetCompressionType
(
ESoundAssetCompressionType InSoundAssetCompressionType, |
Procedurally set the compression type. | |
| void | SetTimecodeInfo
(
const FSoundWaveTimecodeInfo& InTimecode |
||
| bool | Checks whether we should use the load on demand cache. | ||
| void | Attempts to update the cached platform data after any changes that might affect it | ||
| const FWaveTransformUObjectConfiguration & |
Overridden from USoundBase
| Type | Name | Description | |
|---|---|---|---|
| UCurveTable * | GetCurveData () |
Returns curves associated with this sound wave | |
| float | GetDuration () |
Returns the length of the sound | |
| bool | GetSoundWavesWithCookedAnalysisData
(
TArray< USoundWave* >& OutSoundWaves |
Returns whether the sound has cooked analysis data (e.g. FFT or envelope following data) and returns sound waves which have cooked data. | |
| float | Returns the subtitle priority | ||
| bool | |||
| bool | Queries if the sound has cooked FFT or envelope data. | ||
| bool | IsPlayable () |
Returns whether the sound base is set up in a playable manner | |
| void | Parse
(
FAudioDevice* AudioDevice, |
Parses the Sound to generate the WaveInstances to play. | |
| bool | Returns whether sound supports subtitles. |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginCacheForCookedPlatformData
(
const ITargetPlatform* TargetPlatform |
Begins caching platform data in the background for the platform requested | |
| void | BeginDestroy () |
Called before destroying the object. | |
| void | Clear all the cached cooked platform data which we have accumulated with BeginCacheForCookedPlatformData calls The data can still be cached again using BeginCacheForCookedPlatformData again | ||
| void | ClearCachedCookedPlatformData
(
const ITargetPlatform* TargetPlatform |
Clears cached cooked platform data for specific platform | |
| void | Called to finish destroying the object. | ||
| void | GetAssetRegistryTags
(
TArray< FAssetRegistryTag >& OutTags |
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 | |
| FString | GetDesc () |
Return a one line description of an object for viewing in the thumbnail view of the generic browser | |
| FName | Returns the name of the exporter factory used to export this object Used when multiple factories have the same extension | ||
| void | GetResourceSizeEx
(
FResourceSizeEx& CumulativeResourceSize |
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). | |
| bool | IsCachedCookedPlatformDataLoaded
(
const ITargetPlatform* TargetPlatform |
Have we finished loading all the cooked platform data for the target platforms requested in BeginCacheForCookedPlatformData | |
| bool | Called to check if the object is ready for FinishDestroy. | ||
| void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Called when a property on this object has been modified externally | |
| void | Called after the C++ constructor and after the properties have been initialized, including those loaded from config. | ||
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. | |
| void | Handles reading, writing, and reference collecting using FArchive. | ||
| void | All caching has finished for this object (all IsCachedCookedPlatformDataLoaded functions have finished for all platforms) |
Overridden from IAudioProxyDataFactory
| Type | Name | Description | |
|---|---|---|---|
| TSharedPtr< Audio::IProxyData > | CreateProxyData
(
const Audio::FProxyDataInitParams& InitParams |
Overridden from IInterface_AsyncCompilation
| Type | Name | Description | |
|---|---|---|---|
| bool | IsCompiling () |
IInterface_AsyncCompilation begin |
Enums
| Type | Name | Description | |
|---|---|---|---|
| ESoundWaveResourceState |
Typedefs
| Name | Description |
|---|---|
| FAsyncAudioDecompress | Async worker that decompresses the audio data on a different thread |
| FSoundWaveClientPtr |