UAudioComponent

AudioComponent is used to play a Sound

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Components/AudioComponent.h

Include

#include "Components/AudioComponent.h"

Syntax

class UAudioComponent : public USceneComponent

Remarks

AudioComponent is used to play a Sound

Variables

Name Description

Public variable

int32

 

ActiveCount

A count of how many times we've started playing

Public variable

FSoundAttenuati...

 

AttenuationOverrides

If bOverrideSettings is true, the attenuation properties to use for sounds generated by this component

Public variable

USoundAttenuati...

 

AttenuationSettings

If bOverrideSettings is false, the asset to use to determine attenuation properties for sounds generated by this component

Public variable

FName

 

AudioComponentUserID

Configurable, serialized ID for audio plugins

Public variable

uint32

 

AudioDeviceID

The specific audio device to play this component on

Public variable

EAttachmentRule

 

AutoAttachLocationRule

Options for how we handle our location when we attach to the AutoAttachParent, if bAutoManageAttachment is true.

Public variable

TWeakObjectPtr<...

 

AutoAttachParent

Component we automatically attach to when activated, if bAutoManageAttachment is true.

Public variable

EAttachmentRule

 

AutoAttachRotationRule

Options for how we handle our rotation when we attach to the AutoAttachParent, if bAutoManageAttachment is true.

Public variable

EAttachmentRule

 

AutoAttachScaleRule

Options for how we handle our scale when we attach to the AutoAttachParent, if bAutoManageAttachment is true.

Public variable

FName

 

AutoAttachSocketName

Socket we automatically attach to on the AutoAttachParent, if bAutoManageAttachment is true.

Public variable

uint8: 1

 

bAllowSpatialization

Overrides spatialization enablement in either the attenuation asset or on this audio component's attenuation settings override.

Public variable

uint8: 1

 

bAlwaysPlay

Whether to artificially prioritize the component to play

Public variable

uint8: 1

 

bAutoDestroy

Auto destroy this component on completion

Public variable

uint8: 1

 

bAutoManageAttachment

True if we should automatically attach to AutoAttachParent when Played, and detach from our parent when playback is completed.

Public variable

uint8: 1

 

bCenterChannelOnly

Whether or not this sound class forces sounds to the center channel

Public variable

uint8: 1

 

bEnableLowPassFilter

Whether or not to apply a low-pass filter to the sound that plays in this audio component.

Public variable

uint8: 1

 

bIgnoreForFlushing

If true, this sound will not be stopped when flushing the audio device.

Public variable

uint8: 1

 

bIsFadingOut

Whether or not fade out was triggered.

Public variable

uint8: 1

 

bIsMusic

Whether or not this audio component is a music clip

Public variable

uint8: 1

 

bIsPaused

Whether or not this audio component has been paused

Public variable

uint8: 1

 

bIsPreviewSound

Whether or not this sound is a preview sound

Public variable

uint8: 1

 

bIsUISound

Whether or not this sound plays when the game is paused in the UI

Public variable

uint8: 1

 

bIsVirtualized

Whether or not this audio component's sound is virtualized

Public variable

uint8: 1

 

bOverrideAttenuation

Allows defining attenuation settings directly on this audio component without using an attenuation settings asset.

Public variable

uint8: 1

 

bOverridePriority

Public variable

uint8: 1

 

bOverrideSubtitlePriority

Whether or not to override the sound's subtitle priority.

Public variable

uint8: 1

 

bPreviewComponent

Whether this audio component is previewing a sound

Public variable

uint8: 1

 

bReverb

Whether or not the audio component should be excluded from reverb EQ processing

Public variable

uint8: 1

 

bShouldRemainActiveIfDropped

Whether the wave instances should remain active if they're dropped by the prioritization code.

Public variable

uint8: 1

 

bStopWhenOwnerDestroyed

Stop sound when owner is destroyed

Public variable

uint8: 1

 

bSuppressSubtitles

If true, subtitles in the sound data will be ignored.

Public variable

TSet< USoundCon...

 

ConcurrencySet

What sound concurrency rules to use for sounds generated by this audio component

Public variable

int32

 

EnvelopeFollowerAttackTime

The attack time in milliseconds for the envelope follower.

Public variable

int32

 

EnvelopeFollowerReleaseTime

The release time in milliseconds for the envelope follower.

Public variable

float

 

FadeInTimeDuration

How much time the audio component was told to fade in.

Public variable

TArray< struct ...

 

InstanceParameters

Array of per-instance parameters for this AudioComponent.

Public variable

float

 

LowPassFilterFrequency

The frequency of the Lowpass Filter (in Hz) to apply to this voice.

Public variable

FSoundModulatio...

 

ModulationRouting

Public variable

float

 

OcclusionCheckInterval

While playing, this component will check for occlusion from its closest listener every this many seconds

Public variable

FOnAudioFinishe...

 

OnAudioFinished

Called when we finish playing audio, either because it played to completion or because a Stop() call turned it off early

Public variable

FOnAudioFinishe...

 

OnAudioFinishedNative

Shadow delegate for non UObject subscribers

Public variable

FOnAudioMultiEn...

 

OnAudioMultiEnvelopeValue

Public variable

FOnAudioMultiEn...

 

OnAudioMultiEnvelopeValueNative

Shadow delegate for non UObject subscribers

Public variable

FOnAudioPlaybac...

 

OnAudioPlaybackPercent

Called as a sound plays on the audio component to allow BP to perform actions based on playback percentage.

Public variable

FOnAudioPlaybac...

 

OnAudioPlaybackPercentNative

Shadow delegate for non UObject subscribers

Public variable

FOnAudioPlaySta...

 

OnAudioPlayStateChanged

This function returns the Targeted Audio Component's current Play State.

Public variable

FOnAudioPlaySta...

 

OnAudioPlayStateChangedNative

Shadow delegate for non UObject subscribers

Public variable

FOnAudioSingleE...

 

OnAudioSingleEnvelopeValue

Public variable

FOnAudioSingleE...

 

OnAudioSingleEnvelopeValueNative

Shadow delegate for non UObject subscribers

Public variable

FOnAudioVirtual...

 

OnAudioVirtualizationChanged

Called when virtualization state changes

Public variable

FOnAudioVirtual...

 

OnAudioVirtualizationChangedNative

Shadow delegate for non UObject subscribers

Public variable

FOnQueueSubtitl...

 

OnQueueSubtitles

Called when subtitles are sent to the SubtitleManager.

Public variable

float

 

PitchModulationMax

The upper bound to use when randomly determining a pitch multiplier

Public variable

float

 

PitchModulationMin

The lower bound to use when randomly determining a pitch multiplier

Public variable

float

 

PitchMultiplier

A pitch multiplier to apply to sounds generated by this component

Public variable

float

 

Priority

A priority value that is used for sounds that play on this component that scales against final output volume.

Protected variable

FRandomStream

 

RandomStream

Public variable

USoundBase *...

 

Sound

The sound to be played

Public variable

USoundClass ...

 

SoundClassOverride

Optional sound group this AudioComponent belongs to

Public variable

USoundEffectSou...

 

SourceEffectChain

The chain of Source Effects to apply to the sounds playing on the Audio Component

Public variable

float

 

SubtitlePriority

Used by the subtitle manager to prioritize subtitles wave instances spawned by this component.

Public variable

float

 

TimeAudioComponentPlayed

What time the audio component was told to play. Used to compute audio component state.

Public variable

float

 

VolumeModulationMax

The upper bound to use when randomly determining a volume multiplier

Public variable

float

 

VolumeModulationMin

The lower bound to use when randomly determining a volume multiplier

Public variable

float

 

VolumeMultiplier

A volume multiplier to apply to sounds generated by this component

Constructors

Name Description

Public function

UAudioComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

AdjustAttenuation

(
    const FSoundAttenuationSettings& I...
)

This function is used to modify the Attenuation Settings on the targeted Audio Component instance.

Public function

void

 

AdjustVolume

(
    float AdjustVolumeDuration,
    float AdjustVolumeLevel,
    const EAudioFaderCurve FadeCurve
)

This function allows designers to trigger an adjustment to the sound instance's playback Volume with options for smoothly applying a curve over time.

Public function

void

 

AdjustVolumeInternal

(
    float AdjustVolumeDuration,
    float AdjustVolumeLevel,
    bool bIsFadeOut,
    EAudioFaderCurve FadeCurve
)

Public function

bool

 

BP_GetAttenuationSettingsToApply

(
    FSoundAttenuationSettings& OutAtte...
)

Retrieves Attenuation Settings data on the targeted Audio Component.

Public function Const

void

 

CollectAttenuationShapesForVisualization

Collects the various attenuation shapes that may be applied to the sound played by the audio component for visualization in the editor or via the in game debug visualization.

Public function Virtual

void

 

FadeIn

(
    float FadeInDuration,
    float FadeVolumeLevel,
    float StartTime,
    const EAudioFaderCurve FadeCurve
)

This function allows designers to call Play on an Audio Component instance while applying a volume curve over time.

Public function Virtual

void

 

FadeOut

(
    float FadeOutDuration,
    float FadeVolumeLevel,
    const EAudioFaderCurve FadeCurve
)

This function allows designers to call a delayed Stop on an Audio Component instance while applying a volume curve over time.

Public function Const

const FSound...

 

GetAttenuationSettingsToApply()

Returns a pointer to the attenuation settings to be used (if any) for this audio component dependent on the SoundAttenuation asset or overrides set.

Public function Static

UAudioCompon...

 

GetAudioComponentFromID

(
    uint64 AudioComponentID
)

Public function Const

uint64

 

GetAudioComponentID()

Public function Const

FName

 

GetAudioComponentUserID()

Public function Const

FAudioDevice...

 

GetAudioDevice()

Returns the active audio device to use for this component based on whether or not the component is playing in a world.

Public function

bool

 

GetCookedEnvelopeData

(
    float& OutEnvelopeData
)

Retrieves Cooked Envelope Data at the current playback time.

Public function

bool

 

GetCookedEnvelopeDataForAllPlayingSounds

Retrieves the current-time envelope data of the sounds playing audio component.

Public function

bool

 

GetCookedFFTData

(
    const TArray< float >& Frequencies...,
    TArray< FSoundWaveSpectralData >& ...
)

Retrieves the current-time cooked spectral data of the sounds playing on the audio component.

Public function

bool

 

GetCookedFFTDataForAllPlayingSounds

Retrieves the current-time cooked spectral data of the sounds playing audio component.

Public function Const

EAudioCompon...

 

GetPlayState()

Returns the enumerated play states of the audio component.

Public function Const

bool

 

HasCookedAmplitudeEnvelopeData()

Queries whether or not the targeted Audio Component instance's sound has Envelope Data, returns FALSE if none found.

Public function Const

bool

 

HasCookedFFTData()

Queries if the sound wave playing in this audio component has cooked FFT data, returns FALSE if none found.

Public function Virtual Const

bool

 

IsPlaying()

Returns TRUE if the targeted Audio Component's sound is playing.

Public function Const

bool

 

IsVirtualized()

Returns if the sound is virtualized.

Public function Virtual

void

 

Play

(
    float StartTime
)

Begins playing the targeted Audio Component's sound at the designated Start Time, seeking into a sound.

Public function Static

void

 

PlaybackCompleted

(
    uint64 AudioComponentID,
    bool bFailedToStart
)

Protected function

void

 

PlayInternal

(
    const PlayInternalRequestData& InP...
)

Utility function called by Play and FadeIn to start a sound playing.

Public function Virtual

void

 

PlayQuantized

(
    const UObject* WorldContextObj...,
    UQuartzClockHandle*& InClockHa...,
    FQuartzQuantizationBoundary& InQua...,
    const FOnQuartzCommandEventBP& InD...,
    float InStartTime,
    float InFadeInDuration,
    float InFadeVolumeLevel,
    EAudioFaderCurve InFadeCurve
)

Start a sound playing on an audio component on a given quantization boundary with the handle to an existing clock

Public function

void

 

SetAudioBusSendPostEffect

(
    UAudioBus* AudioBus,
    float AudioBusSendLevel
)

Sets how much audio the sound should send to the given Audio Bus (POST Source Effects).

Public function

void

 

SetAudioBusSendPreEffect

(
    UAudioBus* AudioBus,
    float AudioBusSendLevel
)

Sets how much audio the sound should send to the given Audio Bus (PRE Source Effects).

Public function

void

 

SetBoolParameter

(
    FName InName,
    bool InBool
)

Allows the designer to set the Boolean Parameter on the SoundCue whose name matches the name indicated.

Public function

void

 

SetFadeInComplete()

Set when the sound is finished with initial fading in

Public function

void

 

SetFloatParameter

(
    FName InName,
    float InFloat
)

Allows the designer to set the Float Parameter on the SoundCue whose name matches the name indicated.

Public function

void

 

SetIntParameter

(
    FName InName,
    int32 InInt
)

Allows the designer to set the Integer Parameter on the SoundCue whose name matches the name indicated.

Public function

void

 

SetIsVirtualized

(
    bool bInIsVirtualized
)

Sets whether or not sound instance is virtualized

Public function

void

 

SetLowPassFilterEnabled

(
    bool InLowPassFilterEnabled
)

When set to TRUE, enables an additional Low Pass Filter Frequency to be calculated in with the sound instance's LPF total, allowing designers to set filter settings for the targeted Audio Component's sound instance.

Public function

void

 

SetLowPassFilterFrequency

(
    float InLowPassFilterFrequency
)

Sets a cutoff frequency, in Hz, for the targeted Audio Component's sound's Low Pass Filter calculation.

Public function

void

 

SetOutputToBusOnly

(
    bool bInOutputToBusOnly
)

Sets whether or not to output the audio to bus only.

Public function

void

 

SetPaused

(
    bool bPause
)

Pause an audio component playing its sound cue, issue any delegates if needed

Public function

void

 

SetPitchMultiplier

(
    float NewPitchMultiplier
)

Set a new pitch multiplier

Public function

void

 

SetPlaybackTimes

(
    const TMap< uint32, float >& InSou...
)

Sets the audio thread playback time as used by the active sound playing this audio component Will be set if the audio component is using baked FFT or envelope following data so as to be able to feed that data to BP based on playback time

Public function

void

 

SetSound

(
    USoundBase* NewSound
)

Set what sound is played by this component.

Public function

void

 

SetSoundParameter

(
    const FAudioComponentParam& Param
)

Sets the sound instance parameter.

Public function

void

 

SetSourceBusSendPostEffect

(
    USoundSourceBus* SoundSourceBu...,
    float SourceBusSendLevel
)

Allows designers to target a specific Audio Component instance's sound and set the send level (volume of sound copied) to the indicated Source Bus.

Public function

void

 

SetSourceBusSendPreEffect

(
    USoundSourceBus* SoundSourceBu...,
    float SourceBusSendLevel
)

Allows designers to target a specific Audio Component instance's sound and set the send level (volume of sound copied) to the indicated Source Bus.

Public function

void

 

SetSourceEffectChain

Public function

void

 

SetSubmixSend

(
    USoundSubmixBase* Submix,
    float SendLevel
)

Allows designers to target a specific Audio Component instance's sound set the send level (volume of sound copied) to the indicated Submix.

Public function

void

 

SetUISound

(
    bool bInUISound
)

Set whether sounds generated by this audio component should be considered UI sounds

Public function

void

 

SetVolumeMultiplier

(
    float NewVolumeMultiplier
)

Set a new volume multiplier

Public function

void

 

SetWaveParameter

(
    FName InName,
    USoundWave* InWave
)

Allows the designer to set the Wave Parameter on the SoundCue whose name matches the name indicated.

Public function Virtual

void

 

Stop()

Stop an audio component's sound, issue any delegates if needed

Public function

void

 

StopDelayed

(
    float DelayTime
)

Cues request to stop sound after the provided delay (in seconds), stopping immediately if delay is zero or negative

Protected function

void

 

UpdateSpriteTexture()

Utility function that updates which texture is displayed on the sprite dependent on the properties of the Audio Component.

Overridden from USceneComponent

Name Description

Public function Virtual Const

FBoxSphereBo...

 

CalcBounds

(
    const FTransform& LocalToWorld
)

Calculate the bounds of the component. Default behavior is a bounding box/sphere of zero size.

Public function Virtual

void

 

OnUpdateTransform

(
    EUpdateTransformFlags UpdateTransfo...,
    ETeleportType Teleport
)

Native callback when this component is moved

Overridden from UActorComponent

Name Description

Public function Virtual

void

 

Activate

(
    bool bReset
)

Activates the SceneComponent, should be overridden by native child classes.

Public function Virtual Const

const UObjec...

 

AdditionalStatObject()

Give a readable name for this component, including asset name if applicable

Public function Virtual

void

 

Deactivate()

Deactivates the SceneComponent.

Public function Virtual Const

bool

 

IsReadyForOwnerToAutoDestroy()

Overridable check for a component to indicate to its Owner that it should prevent the Actor from auto destroying when finished

Public function Virtual

void

 

OnRegister()

Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called.

Public function Virtual

void

 

OnUnregister()

Called when a component is unregistered.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual Const

FString

 

GetDetailedInfoInternal()

This function actually does the work for the GetDetailedInfo() and is virtual.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

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.

Classes

Name

Description

Public struct

PlayInternalRequestData

Constants

Deprecated Variables

Name Description

Public variable

USoundConcurren...

 

ConcurrencySettings_DEPRECATED

What sound concurrency to use for sounds generated by this audio component

Public variable

float

 

HighFrequencyGainMultiplier_DEPRECATED

Public variable

float

 

VolumeWeightedPriorityScale_DEPRECATED

See Also

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