UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UMediaSoundComponent Class Reference

#include <MediaSoundComponent.h>

+ Inheritance diagram for UMediaSoundComponent:

Public Member Functions

MEDIAASSETS_API UMediaSoundComponent (const FObjectInitializer &ObjectInitializer)
 
MEDIAASSETS_API ~UMediaSoundComponent ()
 
MEDIAASSETS_API bool BP_GetAttenuationSettingsToApply (FSoundAttenuationSettings &OutAttenuationSettings)
 
MEDIAASSETS_API UMediaPlayerGetMediaPlayer () const
 
virtual USoundClassGetSoundClass () override
 
MEDIAASSETS_API void SetMediaPlayer (UMediaPlayer *NewMediaPlayer)
 
MEDIAASSETS_API void SetEnableSpectralAnalysis (bool bInSpectralAnalysisEnabled)
 
MEDIAASSETS_API void SetSpectralAnalysisSettings (TArray< float > InFrequenciesToAnalyze, EMediaSoundComponentFFTSize InFFTSize=EMediaSoundComponentFFTSize::Medium_512)
 
MEDIAASSETS_API TArray< FMediaSoundComponentSpectralDataGetSpectralData ()
 
MEDIAASSETS_API TArray< FMediaSoundComponentSpectralDataGetNormalizedSpectralData ()
 
MEDIAASSETS_API void SetEnableEnvelopeFollowing (bool bInEnvelopeFollowing)
 
MEDIAASSETS_API void SetEnvelopeFollowingsettings (int32 AttackTimeMsec, int32 ReleaseTimeMsec)
 
MEDIAASSETS_API float GetEnvelopeValue () const
 
MEDIAASSETS_API void AddClockSink ()
 
MEDIAASSETS_API void RemoveClockSink ()
 
MEDIAASSETS_API void UpdatePlayer ()
 
MEDIAASSETS_API void CollectAttenuationShapesForVisualization (TMultiMap< EAttenuationShape::Type, FBaseAttenuationSettings::AttenuationShapeDetails > &ShapeDetailsMap) const
 
virtual MEDIAASSETS_API void OnRegister () override
 
virtual MEDIAASSETS_API void OnUnregister () override
 
virtual MEDIAASSETS_API void TickComponent (float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override
 
virtual MEDIAASSETS_API void Activate (bool bReset=false) override
 
virtual MEDIAASSETS_API void Deactivate () override
 
virtual MEDIAASSETS_API void PostLoad () override
 
- Public Member Functions inherited from USynthComponent
AUDIOMIXER_API USynthComponent (const FObjectInitializer &ObjectInitializer)
 
virtual AUDIOMIXER_API bool IsReadyForOwnerToAutoDestroy () const override
 
virtual AUDIOMIXER_API void EndPlay (const EEndPlayReason::Type Reason) override
 
virtual AUDIOMIXER_API void Serialize (FArchive &Ar) override
 
AUDIOMIXER_API void Start ()
 
AUDIOMIXER_API void Stop ()
 
AUDIOMIXER_API bool IsPlaying () const
 
AUDIOMIXER_API void SetVolumeMultiplier (float VolumeMultiplier)
 
AUDIOMIXER_API void SetSubmixSend (USoundSubmixBase *Submix, float SendLevel)
 
AUDIOMIXER_API void SetSourceBusSendPreEffect (USoundSourceBus *SoundSourceBus, float SourceBusSendLevel)
 
AUDIOMIXER_API void SetSourceBusSendPostEffect (USoundSourceBus *SoundSourceBus, float SourceBusSendLevel)
 
AUDIOMIXER_API void SetAudioBusSendPreEffect (UAudioBus *AudioBus, float AudioBusSendLevel)
 
AUDIOMIXER_API void SetAudioBusSendPostEffect (UAudioBus *AudioBus, float AudioBusSendLevel)
 
AUDIOMIXER_API void SetLowPassFilterEnabled (bool InLowPassFilterEnabled)
 
virtual AUDIOMIXER_API void SetLowPassFilterFrequency (float InLowPassFilterFrequency)
 
AUDIOMIXER_API void SetOutputToBusOnly (bool bInOutputToBusOnly)
 
AUDIOMIXER_API void FadeIn (float FadeInDuration, float FadeVolumeLevel=1.0f, float StartTime=0.0f, const EAudioFaderCurve FadeCurve=EAudioFaderCurve::Linear) const
 
AUDIOMIXER_API void FadeOut (float FadeOutDuration, float FadeVolumeLevel, const EAudioFaderCurve FadeCurve=EAudioFaderCurve::Linear) const
 
AUDIOMIXER_API void AdjustVolume (float AdjustVolumeDuration, float AdjustVolumeLevel, const EAudioFaderCurve FadeCurve=EAudioFaderCurve::Linear) const
 
AUDIOMIXER_API void SetModulationRouting (const TSet< USoundModulatorBase * > &Modulators, const EModulationDestination Destination, const EModulationRouting RoutingMethod=EModulationRouting::Inherit)
 
AUDIOMIXER_API UPARAM (DisplayName="Modulators") TSet< USoundModulatorBase * > GetModulators(const EModulationDestination Destination)
 
AUDIOMIXER_API void Initialize (int32 SampleRateOverride=INDEX_NONE)
 
AUDIOMIXER_API void CreateAudioComponent ()
 
AUDIOMIXER_API UAudioComponentGetAudioComponent ()
 
AUDIOMIXER_API void OnAudioComponentEnvelopeValue (const UAudioComponent *AudioComponent, const USoundWave *SoundWave, const float EnvelopeValue)
 
AUDIOMIXER_API void AddAudioBufferListener (IAudioBufferListener *InAudioBufferListener)
 
AUDIOMIXER_API void RemoveAudioBufferListener (IAudioBufferListener *InAudioBufferListener)
 
virtual AUDIOMIXER_API void BeginDestroy () override
 

Public Attributes

EMediaSoundChannels Channels
 
bool DynamicRateAdjustment
 
float RateAdjustmentFactor
 
FFloatRange RateAdjustmentRange
 
- Public Attributes inherited from USynthComponent
uint8 bAutoDestroy: 1
 
uint8 bStopWhenOwnerDestroyed: 1
 
uint8 bAllowSpatialization: 1
 
uint8 bOverrideAttenuation: 1
 
uint32 bEnableBusSends: 1
 
uint32 bEnableBaseSubmix: 1
 
uint32 bEnableSubmixSends: 1
 
TObjectPtr< class USoundAttenuationAttenuationSettings
 
struct FSoundAttenuationSettings AttenuationOverrides
 
TObjectPtr< USoundConcurrencyConcurrencySettings_DEPRECATED
 
TSet< TObjectPtr< USoundConcurrency > > ConcurrencySet
 
FSoundModulationDefaultRoutingSettings ModulationRouting
 
TObjectPtr< USoundClassSoundClass
 
TObjectPtr< USoundEffectSourcePresetChainSourceEffectChain
 
TObjectPtr< USoundSubmixBaseSoundSubmix
 
TArray< FSoundSubmixSendInfoSoundSubmixSends
 
TArray< FSoundSourceBusSendInfoBusSends
 
TArray< FSoundSourceBusSendInfoPreEffectBusSends
 
uint8 bIsUISound: 1
 
uint8 bIsPreviewSound: 1
 
uint8 bAlwaysPlay: 1
 
int32 EnvelopeFollowerAttackTime
 
int32 EnvelopeFollowerReleaseTime
 
FOnSynthEnvelopeValue OnAudioEnvelopeValue
 
FOnSynthEnvelopeValueNative OnAudioEnvelopeValueNative
 

Protected Member Functions

MEDIAASSETS_API const FSoundAttenuationSettingsGetSelectedAttenuationSettings () const
 
virtual MEDIAASSETS_API bool Init (int32 &SampleRate) override
 
virtual MEDIAASSETS_API ISoundGeneratorPtr CreateSoundGenerator (const FSoundGeneratorInitParams &InParams) override
 
- Protected Member Functions inherited from USynthComponent
AUDIOMIXER_API void SynthCommand (TFunction< void()> Command)
 
virtual void OnStart ()
 
virtual void OnStop ()
 
virtual void OnBeginGenerate ()
 
virtual void OnEndGenerate ()
 
virtual int32 OnGenerateAudio (float *OutAudio, int32 NumSamples)
 
AUDIOMIXER_API int32 OnGeneratePCMAudio (float *GeneratedPCMData, int32 NumSamples)
 
AUDIOMIXER_API FAudioDeviceGetAudioDevice () const
 

Protected Attributes

TObjectPtr< UMediaPlayerMediaPlayer
 
- Protected Attributes inherited from USynthComponent
int32 NumChannels
 
int32 PreferredBufferLength
 

Detailed Description

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

Constructor & Destructor Documentation

◆ UMediaSoundComponent()

UMediaSoundComponent::UMediaSoundComponent ( const FObjectInitializer ObjectInitializer)

Create and initialize a new instance.

Parameters
ObjectInitializerInitialization parameters.

◆ ~UMediaSoundComponent()

UMediaSoundComponent::~UMediaSoundComponent ( )

Virtual destructor.

Member Function Documentation

◆ Activate()

void UMediaSoundComponent::Activate ( bool  bReset = false)
overridevirtual

Reimplemented from USynthComponent.

◆ AddClockSink()

void UMediaSoundComponent::AddClockSink ( )

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

◆ BP_GetAttenuationSettingsToApply()

bool UMediaSoundComponent::BP_GetAttenuationSettingsToApply ( FSoundAttenuationSettings OutAttenuationSettings)

Get the attenuation settings based on the current component settings.

Parameters
OutAttenuationSettingsWill contain the attenuation settings, if available.
Returns
true if attenuation settings were returned, false if attenuation is disabled.

◆ CollectAttenuationShapesForVisualization()

void UMediaSoundComponent::CollectAttenuationShapesForVisualization ( TMultiMap< EAttenuationShape::Type, FBaseAttenuationSettings::AttenuationShapeDetails > &  ShapeDetailsMap) const

◆ CreateSoundGenerator()

ISoundGeneratorPtr UMediaSoundComponent::CreateSoundGenerator ( const FSoundGeneratorInitParams InParams)
overrideprotectedvirtual

Reimplemented from USynthComponent.

◆ Deactivate()

void UMediaSoundComponent::Deactivate ( )
overridevirtual

Reimplemented from USynthComponent.

◆ GetEnvelopeValue()

float UMediaSoundComponent::GetEnvelopeValue ( ) const

Retrieves the current amplitude envelope.

◆ GetMediaPlayer()

UMediaPlayer * UMediaSoundComponent::GetMediaPlayer ( ) const

Get the media player that provides the audio samples.

Returns
The component's media player, or nullptr if not set.
See also
SetMediaPlayer

◆ GetNormalizedSpectralData()

TArray< FMediaSoundComponentSpectralData > UMediaSoundComponent::GetNormalizedSpectralData ( )

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

◆ GetSelectedAttenuationSettings()

const FSoundAttenuationSettings * UMediaSoundComponent::GetSelectedAttenuationSettings ( ) const
protected

Get the attenuation settings based on the current component settings.

Returns
Attenuation settings, or nullptr if attenuation is disabled.

◆ GetSoundClass()

virtual USoundClass * UMediaSoundComponent::GetSoundClass ( )
inlineoverridevirtual

Reimplemented from USynthComponent.

◆ GetSpectralData()

TArray< FMediaSoundComponentSpectralData > UMediaSoundComponent::GetSpectralData ( )

Retrieves the spectral data if spectral analysis is enabled.

◆ Init()

bool UMediaSoundComponent::Init ( int32 SampleRate)
overrideprotectedvirtual

Reimplemented from USynthComponent.

◆ OnRegister()

void UMediaSoundComponent::OnRegister ( )
overridevirtual

Reimplemented from USynthComponent.

◆ OnUnregister()

void UMediaSoundComponent::OnUnregister ( )
overridevirtual

Reimplemented from USynthComponent.

◆ PostLoad()

void UMediaSoundComponent::PostLoad ( )
overridevirtual

◆ RemoveClockSink()

void UMediaSoundComponent::RemoveClockSink ( )

Removes the clock sink.

◆ SetEnableEnvelopeFollowing()

void UMediaSoundComponent::SetEnableEnvelopeFollowing ( bool  bInEnvelopeFollowing)

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

◆ SetEnableSpectralAnalysis()

void UMediaSoundComponent::SetEnableSpectralAnalysis ( bool  bInSpectralAnalysisEnabled)

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

◆ SetEnvelopeFollowingsettings()

void UMediaSoundComponent::SetEnvelopeFollowingsettings ( int32  AttackTimeMsec,
int32  ReleaseTimeMsec 
)

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

◆ SetMediaPlayer()

void UMediaSoundComponent::SetMediaPlayer ( UMediaPlayer NewMediaPlayer)

Set the media player that provides the audio samples.

Parameters
NewMediaPlayerThe player to set.
See also
GetMediaPlayer

◆ SetSpectralAnalysisSettings()

void UMediaSoundComponent::SetSpectralAnalysisSettings ( TArray< float InFrequenciesToAnalyze,
EMediaSoundComponentFFTSize  InFFTSize = EMediaSoundComponentFFTSize::Medium_512 
)

Sets the settings to use for spectral analysis.

◆ TickComponent()

void UMediaSoundComponent::TickComponent ( float  DeltaTime,
enum ELevelTick  TickType,
FActorComponentTickFunction ThisTickFunction 
)
overridevirtual

◆ UpdatePlayer()

void UMediaSoundComponent::UpdatePlayer ( )

Member Data Documentation

◆ Channels

EMediaSoundChannels UMediaSoundComponent::Channels

Media sound channel type.

◆ DynamicRateAdjustment

bool UMediaSoundComponent::DynamicRateAdjustment

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

◆ MediaPlayer

TObjectPtr<UMediaPlayer> UMediaSoundComponent::MediaPlayer
protected

The media player asset associated with this component.

This property is meant for design-time convenience. To change the associated media player at run-time, use the SetMediaPlayer method.

See also
SetMediaPlayer

◆ RateAdjustmentFactor

float UMediaSoundComponent::RateAdjustmentFactor

Factor for calculating the sample rate adjustment.

If dynamic rate adjustment is enabled, this number is multiplied with the drift between the audio and media clock (in 100ns ticks) to determine the adjustment. that is to be multiplied into the current playrate.

◆ RateAdjustmentRange

FFloatRange UMediaSoundComponent::RateAdjustmentRange

The allowed range of dynamic rate adjustment.

If dynamic rate adjustment is enabled, and the necessary adjustment falls outside of this range, audio samples will be dropped.


The documentation for this class was generated from the following files: