UMediaSoundComponent

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

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

UMediaPlayer &#...

 

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

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.

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

 

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

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.

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

 

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

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Constants

Name

Description

DefaultMediaSoundClassObject

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback