UMediaSoundComponent

Implements a sound component for playing a media player's audio output.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

MediaAssets

Header

/Engine/Source/Runtime/MediaAssets/Public/MediaSoundComponent.h

Include

#include "MediaSoundComponent.h"

Syntax

class UMediaSoundComponent : public USynthComponent

Remarks

Implements a sound component for playing a media player's audio output.

Variables

Name Description

Public variable

EMediaSoundChan...

 

Channels

Media sound channel type.

Public variable

bool

 

DynamicRateAdjustment

Dynamically adjust the sample rate if audio and media clock desynchronize.

Protected variable

TObjectPtr< UMe...

 

MediaPlayer

The media player asset associated with this component.

Public variable

float

 

RateAdjustmentFactor

Factor for calculating the sample rate adjustment.

Public variable

FFloatRange

 

RateAdjustmentRange

The allowed range of dynamic rate adjustment.

Constructors

Name Description

Public function

UMediaSoundComponent

(
    const FObjectInitializer& ObjectIn...
)

Create and initialize a new instance.

Destructors

Name Description

Public function

~UMediaSoundComponent()

Virtual destructor.

Functions

Name Description

Public function

void

 

AddClockSink()

Adds a clock sink so this can be ticked without the world.

Public function

bool

 

BP_GetAttenuationSettingsToApply

(
    FSoundAttenuationSettings& OutAtte...
)

Get the attenuation settings based on the current component settings.

Public function Const

void

 

CollectAttenuationShapesForVisualization

Public function Const

float

 

GetEnvelopeValue()

Retrieves the current amplitude envelope.

Public function Const

UMediaPlayer...

 

GetMediaPlayer()

Get the media player that provides the audio samples.

Public function

TArray< FMed...

 

GetNormalizedSpectralData()

Retrieves and normalizes the spectral data if spectral analysis is enabled.

Protected function Const

const FSound...

 

GetSelectedAttenuationSettings()

Get the attenuation settings based on the current component settings.

Public function

TArray< FMed...

 

GetSpectralData()

Retrieves the spectral data if spectral analysis is enabled.

Public function

void

 

RemoveClockSink()

Removes the clock sink.

Public function

void

 

SetDefaultMediaPlayer

(
    UMediaPlayer* NewMediaPlayer
)

Set the component's default media player property.

Public function

void

 

SetEnableEnvelopeFollowing

(
    bool bInEnvelopeFollowing
)

Turns on amplitude envelope following the audio in the media sound component.

Public function

void

 

SetEnableSpectralAnalysis

(
    bool bInSpectralAnalysisEnabled
)

Turns on spectral analysis of the audio generated in the media sound component.

Public function

void

 

SetEnvelopeFollowingsettings

(
    int32 AttackTimeMsec,
    int32 ReleaseTimeMsec
)

Sets the envelope attack and release times (in ms).

Public function

void

 

SetMediaPlayer

(
    UMediaPlayer* NewMediaPlayer
)

Set the media player that provides the audio samples.

Public function

void

 

SetSpectralAnalysisSettings

(
    TArray< float > InFrequenciesToAnal...,
    EMediaSoundComponentFFTSize InFFTSi...
)

Sets the settings to use for spectral analysis.

Public function

void

 

UpdatePlayer()

Overridden from USynthComponent

Name Description

Public function Virtual

USoundClass ...

 

GetSoundClass()

Protected function Virtual

bool

 

Init

(
    int32& SampleRate
)

Called when synth is created.

Protected function Virtual

int32

 

OnGenerateAudio

(
    float* OutAudio,
    int32 NumSamples
)

Called when more audio is needed to be generated This method of generating audio is soon to be deprecated.

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

void

 

Deactivate()

Deactivates the SceneComponent.

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.

Public function Virtual

void

 

TickComponent

(
    float DeltaTime,
    enum ELevelTick TickType,
    FActorComponentTickFunction* T...
)

Function called every frame on this ActorComponent.

Overridden from UObject

Name Description

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.