Class UAudioAnalyzerSoundWave

Inheritance Relationships

Base Type

  • public USoundWaveProcedural

Class Documentation

class UAudioAnalyzerSoundWave : public USoundWaveProcedural

SoundWaveProcedural custom class

Public Functions

virtual void BeginDestroy() override

Begin Destroy override method

void Play(int32 Loops, float StartTime)

Initializes the playback parameters of the sound

Parameters:
  • Loops – Number of loops

  • StartTime – Starting playback position (Seconds)

void AsyncStopSound()

Stops playback

void PauseSound()

Pauses playback if the device is in playing state UnPauses playback if the device has been paused previously

void SetPaused(bool Pause)

Sets the playback state on pause/unpause state

Parameters:

Pause – New pause state

float GetPlaybackTime()

Returns current playback position in seconds

Returns:

Playback position

void SetPlaybackTime(float Time)

Sets current playback position

Parameters:

Time – New playback position in seconds

float GetTotalDuration() const

Returns total player playback duration

Returns:

Playback duration

float GetDuration() override
bool IsPlaying() const

Returns playback playing state

Returns:

playback is playing

bool IsPaused() const

Returns playback pause state

Returns:

playback is paused

inline const int GetRemainingLoops() const

Returns remaining loops to play

Returns:

remaining loops

void PlaySound2D(const UObject *WorldContextObject, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, int32 Loops = 1, USoundConcurrency *ConcurrencySettings = nullptr, AActor *OwningActor = nullptr)

Plays a sound directly with no attenuation, perfect for UI sounds.

  • Fire and Forget.

  • Not Replicated.

Parameters:
  • WorldContextObject – World Context Object

  • VolumeMultiplier – Multiplied with the volume to make the sound louder or softer.

  • PitchMultiplier – Multiplies the pitch.

  • StartTime – How far in to the sound to begin playback at

  • Loops – Number of Loops (Default: 1)

  • ConcurrencySettings – Override concurrency settings package to play sound with

  • OwningActor – The actor to use as the “owner” for concurrency settings purposes. Allows PlaySound calls to do a concurrency limit per owner.

UAudioComponent *SpawnSound2D(const UObject *WorldContextObject, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, int32 Loops = 1, USoundConcurrency *ConcurrencySettings = nullptr, bool bPersistAcrossLevelTransition = false, bool bAutoDestroy = true)

Spawns a sound with no attenuation, perfect for UI sounds.

  • Not Replicated.

Parameters:
  • WorldContextObject – World Context Object

  • VolumeMultiplier – Multiplied with the volume to make the sound louder or softer.

  • PitchMultiplier – Multiplies the pitch.

  • StartTime – How far in to the sound to begin playback at

  • Loops – Number of Loops (Default: 1)

  • ConcurrencySettings – Override concurrency settings package to play sound with

  • bPersistAcrossLevelTransition – Whether the sound should continue to play when the map it was played in is unloaded

  • bAutoDestroy – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns:

An audio component to manipulate the spawned sound

UAudioComponent *CreateSound2D(const UObject *WorldContextObject, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, int32 Loops = 1, USoundConcurrency *ConcurrencySettings = nullptr, bool bPersistAcrossLevelTransition = false, bool bAutoDestroy = true)

Creates a sound with no attenuation, perfect for UI sounds. This does NOT play the sound

  • Not Replicated.

Parameters:
  • WorldContextObject – World Context Object

  • VolumeMultiplier – Multiplied with the volume to make the sound louder or softer.

  • PitchMultiplier – Multiplies the pitch.

  • StartTime – How far in to the sound to begin playback at

  • Loops – Number of Loops (Default: 1)

  • ConcurrencySettings – Override concurrency settings package to play sound with

  • bPersistAcrossLevelTransition – Whether the sound should continue to play when the map it was played in is unloaded

  • bAutoDestroy – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns:

An audio component to manipulate the created sound

void PlaySoundAtLocation(const UObject *WorldContextObject, FVector Location, FRotator Rotation, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, int32 Loops = 1, class USoundAttenuation *Attenuation_Settings = nullptr, USoundConcurrency *ConcurrencySettings = nullptr, AActor *OwningActor = nullptr)

Plays a sound at the given location. This is a fire and forget sound and does not travel with any actor. Replication is also not handled at this point.

Parameters:
  • WorldContextObject – World Context Object

  • Location – World position to play sound at

  • Rotation – World rotation to play sound at

  • VolumeMultiplier – Volume multiplier

  • PitchMultiplier – PitchMultiplier

  • StartTime – How far in to the sound to begin playback at

  • Loops – Number of Loops (Default: 1)

  • Attenuation_Settings – Override attenuation settings package to play sound with

  • ConcurrencySettings – Override concurrency settings package to play sound with

  • OwningActor – The actor to use as the “owner” for concurrency settings purposes. Allows PlaySound calls to do a concurrency limit per owner.

UAudioComponent *SpawnSoundAtLocation(const UObject *WorldContextObject, FVector Location, FRotator Rotation = FRotator::ZeroRotator, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, int32 Loops = 1, class USoundAttenuation *Attenuation_Settings = nullptr, USoundConcurrency *ConcurrencySettings = nullptr, bool bAutoDestroy = true)

Spawns a sound at the given location. This does not travel with any actor. Replication is also not handled at this point.

Parameters:
  • WorldContextObject – World Context Object

  • Location – World position to play sound at

  • Rotation – World rotation to play sound at

  • VolumeMultiplier – Volume multiplier

  • PitchMultiplier – PitchMultiplier

  • StartTime – How far in to the sound to begin playback at

  • Loops – Number of Loops (Default: 1)

  • Attenuation_Settings – Override attenuation settings package to play sound with

  • ConcurrencySettings – Override concurrency settings package to play sound with

  • bAutoDestroy – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns:

An audio component to manipulate the spawned sound

UAudioComponent *SpawnSoundAttached(USceneComponent *AttachToComponent, FName AttachPointName = NAME_None, FVector Location = FVector(ForceInit), FRotator Rotation = FRotator::ZeroRotator, EAttachLocation::Type LocationType = EAttachLocation::KeepRelativeOffset, bool bStopWhenAttachedToDestroyed = false, float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, int32 Loops = 1, USoundAttenuation *Attenuation_Settings = nullptr, USoundConcurrency *ConcurrencySettings = nullptr, bool bAutoDestroy = true)

Plays a sound attached to and following the specified component. This is a fire and forget sound. Replication is also not handled at this point.

Parameters:
  • AttachToComponent – Component to attach to.

  • AttachPointName – Optional named point within the AttachComponent to play the sound at

  • Location – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world position that will be translated to a relative offset

  • Rotation – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world rotation that will be translated to a relative offset

  • LocationType – Specifies whether Location is a relative offset or an absolute world position

  • bStopWhenAttachedToDestroyed – Specifies whether the sound should stop playing when the owner of the attach to component is destroyed.

  • VolumeMultiplier – Volume multiplier

  • PitchMultiplier – PitchMultiplier

  • StartTime – How far in to the sound to begin playback at

  • Loops – Number of Loops (Default: 1)

  • Attenuation_Settings – Override attenuation settings package to play sound with

  • ConcurrencySettings – Override concurrency settings package to play sound with

  • bAutoDestroy – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns:

An audio component to manipulate the spawned sound

float GetPlaybackProgress(float &bufferPosTime)

Returns the playback progress and buffer postion time

Parameters:

bufferPosTime[out] Buffer position (same as below value)

Returns:

float Progress in seconds

virtual int32 OnGeneratePCMAudio(TArray<uint8> &OutAudio, int32 NumSamples) override

Callback to the send the data to the audio render thread

Parameters:
  • OutAudio – Retrieved PCM data array

  • NumSamples – Required number of samples

Returns:

int32 Number of retrieved samples

virtual Audio::EAudioMixerStreamDataFormat::Type GetGeneratedPCMDataFormat() const override

Gets the format of the retrieved PCM data

Returns:

Audio format type

virtual void OnBeginGenerate() override

Overrides SoundWave OnBeginGenerate Event

virtual void OnEndGenerate() override

Overrides SoundWave OnEndGenerate Event

virtual bool IsPlayable() const override

Overrides SoundBase IsPlayable Event

Returns:

bool Is valid to be played

void InitializeSoundWave(AudioAnalyzerExtractor *ParentSource)

Initializes the soundwave object with the controller class

Parameters:

ParentSource – This class will be used by the Core to sync the analysis

void InvalidateSoundWave()

Detach parent audio extractor class

bool HasParent() const

The soundwave has a valid parent audio extractor class with audio data

Returns:

bool Has a valid audio analyzer extractor pointer

bool HasAudioComponent() const

The sound is used in the audio component of the parent audio extractor class

Returns:

bool Has an audio component linked to the audio extractor

UAudioAnalyzerSoundWave(const FObjectInitializer &ObjectInitializer)

Constructor

virtual ~UAudioAnalyzerSoundWave()

Destructor

Public Members

FPlaybackDelegateSoundWave OnPlaybackFinished

Event to track the playback end

FPlaybackDelegateSoundWave OnPlaybackLoopFinished

Event to track the playback end

FPlaybackDelegateSoundWave OnStopFinished

Event to track the playback end