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

 

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 hertz) to apply to this voice.

Public variable

FSoundModulatio...

 

Modulation

Modulation for the sound

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

FOnAudioSingleE...

 

OnAudioSingleEnvelopeValue

Public variable

FOnAudioSingleE...

 

OnAudioSingleEnvelopeValueNative

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

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

Modify the attenuation settings of the audio component

Public function

void

 

AdjustVolume

(
    float AdjustVolumeDuration,
    float AdjustVolumeLevel,
    const EAudioFaderCurve FadeCurve
)

This will allow one to adjust the volume of an AudioComponent on the fly

Public function

void

 

AdjustVolumeInternal

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

Public function

bool

 

BP_GetAttenuationSettingsToApply

(
    FSoundAttenuationSettings& OutAtte...
)

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 can be used in place of "play" when it is desired to fade in the sound over time.

Public function Virtual

void

 

FadeOut

(
    float FadeOutDuration,
    float FadeVolumeLevel,
    const EAudioFaderCurve FadeCurve
)

This is used in place of "stop" when it is desired to fade the volume of the sound before stopping.

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 the current-time cooked envelope data of the playing audio component.

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 if the sound wave playing in this audio component has cooked amplitude analyses.

Public function Const

bool

 

HasCookedFFTData()

Queries if the sound wave playing in this audio component has cooked FFT data.

Public function Virtual Const

bool

 

IsPlaying()

Returns if the sound playing any audio.

Public function Virtual

void

 

Play

(
    float StartTime
)

Start a sound playing on an audio component

Public function Static

void

 

PlaybackCompleted

(
    uint64 AudioComponentID,
    bool bFailedToStart
)

Protected function

void

 

PlayInternal

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

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

Public function

void

 

SetBoolParameter

(
    FName InName,
    bool InBool
)

Set a boolean instance parameter for use in sound cues played by this audio component

Public function

void

 

SetFloatParameter

(
    FName InName,
    float InFloat
)

Set a float instance parameter for use in sound cues played by this audio component

Public function

void

 

SetIntParameter

(
    FName InName,
    int32 InInt
)

Set an integer instance parameter for use in sound cues played by this audio component

Public function

void

 

SetLowPassFilterEnabled

(
    bool InLowPassFilterEnabled
)

Sets whether or not the low pass filter is enabled on the audio component.

Public function

void

 

SetLowPassFilterFrequency

(
    float InLowPassFilterFrequency
)

Sets lowpass filter frequency of the audio component.

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
)

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

Public function

void

 

SetSourceBusSendPreEffect

(
    USoundSourceBus* SoundSourceBu...,
    float SourceBusSendLevel
)

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

Public function

void

 

SetSourceEffectChain

Public function

void

 

SetSubmixSend

(
    USoundSubmixBase* Submix,
    float SendLevel
)

Sets how much audio the sound should send to the given 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
)

Set a sound wave instance parameter for use in sound cues played by this audio component

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

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