Navigation
API > API/Runtime > API/Runtime/MediaAssets
Implements a sound component for playing a media player's audio output.
| Name | UMediaSoundComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/MediaAssets/Public/MediaSoundComponent.h |
| Include Path | #include "MediaSoundComponent.h" |
Syntax
UCLASS (ClassGroup=Media, EditInlineNew, Meta=(BlueprintSpawnableComponent), MinimalAPI)
class UMediaSoundComponent : public USynthComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → USynthComponent → UMediaSoundComponent
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UMediaSoundComponent
(
const FObjectInitializer& ObjectInitializer |
Create and initialize a new instance. | MediaSoundComponent.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~UMediaSoundComponent() |
Virtual destructor. | MediaSoundComponent.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Channels | EMediaSoundChannels | Media sound channel type. | MediaSoundComponent.h |
|
| DynamicRateAdjustment | bool | Dynamically adjust the sample rate if audio and media clock desynchronize. | MediaSoundComponent.h |
|
| RateAdjustmentFactor | float | Factor for calculating the sample rate adjustment. | MediaSoundComponent.h |
|
| RateAdjustmentRange | FFloatRange | The allowed range of dynamic rate adjustment. | MediaSoundComponent.h |
|
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bEnvelopeFollowingEnabled | bool | Whether or not envelope following is enabled. | MediaSoundComponent.h | |
| bSpectralAnalysisEnabled | bool | Whether or not spectral analysis is enabled. | MediaSoundComponent.h | |
| CachedRate | float | The player's current play rate (cached for use on audio thread). | MediaSoundComponent.h | |
| CachedTime | FTimespan | The player's current time (cached for use on audio thread). | MediaSoundComponent.h | |
| ClockSink | TSharedPtr< FMediaSoundComponentClockSink, ESPMode::ThreadSafe > | Holds our clock sink if available. | MediaSoundComponent.h | |
| CriticalSection | FTransactionallySafeCriticalSection | Critical section for synchronizing access to PlayerFacadePtr. | MediaSoundComponent.h | |
| CurrentPlayer | TWeakObjectPtr< UMediaPlayer > | The player that is currently associated with this component. | MediaSoundComponent.h | |
| CurrentPlayerFacade | TWeakPtr< FMediaPlayerFacade, ESPMode::ThreadSafe > | The player facade that's currently providing texture samples. | MediaSoundComponent.h | |
| EnvelopeFollowerAttackTime | int32 | MediaSoundComponent.h | ||
| EnvelopeFollowerReleaseTime | int32 | MediaSoundComponent.h | ||
| FrequenciesToAnalyze | TArray< float > | Which frequencies to analyze. | MediaSoundComponent.h | |
| LastPlaySampleTime | FTimespan | Time of last sample played. | MediaSoundComponent.h | |
| MediaSoundGenerator | ISoundGeneratorPtr | Instance of our media sound generator. | MediaSoundComponent.h | |
| RateAdjustment | float | Adjusts the output sample rate to synchronize audio and media clock. | MediaSoundComponent.h | |
| SampleQueue | TSharedPtr< FMediaAudioSampleQueue, ESPMode::ThreadSafe > | Audio sample queue. | MediaSoundComponent.h | |
| SpectrumAnalyzerSettings | Audio::FSpectrumAnalyzerSettings | Spectrum analyzer used for analyzing audio in media. | MediaSoundComponent.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddClockSink() |
Adds a clock sink so this can be ticked without the world. | MediaSoundComponent.h | |
bool BP_GetAttenuationSettingsToApply
(
FSoundAttenuationSettings& OutAttenuationSettings |
Get the attenuation settings based on the current component settings. | MediaSoundComponent.h |
|
void CollectAttenuationShapesForVisualization
(
TMultiMap< EAttenuationShape::Type, FBaseAttenuationSettings::AttenuationShapeDetails >& ShapeDetai... |
MediaSoundComponent.h | ||
float GetEnvelopeValue() |
Retrieves the current amplitude envelope. | MediaSoundComponent.h |
|
| Get the media player that provides the audio samples. | MediaSoundComponent.h |
|
|
TArray< FMediaSoundComponentSpectralData > GetNormalizedSpectralData() |
Retrieves and normalizes the spectral data if spectral analysis is enabled. | MediaSoundComponent.h |
|
TArray< FMediaSoundComponentSpectralData > GetSpectralData() |
Retrieves the spectral data if spectral analysis is enabled. | MediaSoundComponent.h |
|
void RemoveClockSink() |
Removes the clock sink. | MediaSoundComponent.h | |
void SetDefaultMediaPlayer
(
UMediaPlayer* NewMediaPlayer |
Set the component's default media player property. | MediaSoundComponent.h | |
void SetEnableEnvelopeFollowing
(
bool bInEnvelopeFollowing |
Turns on amplitude envelope following the audio in the media sound component. | MediaSoundComponent.h |
|
void SetEnableSpectralAnalysis
(
bool bInSpectralAnalysisEnabled |
Turns on spectral analysis of the audio generated in the media sound component. | MediaSoundComponent.h |
|
void SetEnvelopeFollowingsettings
(
int32 AttackTimeMsec, |
Sets the envelope attack and release times (in ms). | MediaSoundComponent.h |
|
void SetMediaPlayer
(
UMediaPlayer* NewMediaPlayer |
Set the media player that provides the audio samples. | MediaSoundComponent.h |
|
void SetSpectralAnalysisSettings
(
TArray< float > InFrequenciesToAnalyze, |
Sets the settings to use for spectral analysis. | MediaSoundComponent.h |
|
virtual void TickComponent
(
float DeltaTime, |
MediaSoundComponent.h | ||
void UpdatePlayer() |
MediaSoundComponent.h |
Overridden from USynthComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Activate
(
bool bReset |
MediaSoundComponent.h | ||
virtual void Deactivate() |
MediaSoundComponent.h | ||
virtual USoundClass * GetSoundClass() |
MediaSoundComponent.h | ||
virtual void OnRegister() |
MediaSoundComponent.h | ||
virtual void OnUnregister() |
MediaSoundComponent.h | ||
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
MediaSoundComponent.h | ||
virtual void PostLoad() |
MediaSoundComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
const FSoundAttenuationSettings * GetSelectedAttenuationSettings() |
Get the attenuation settings based on the current component settings. | MediaSoundComponent.h |
Overridden from USynthComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ISoundGeneratorPtr CreateSoundGenerator
(
const FSoundGeneratorInitParams& InParams |
MediaSoundComponent.h | ||
virtual bool Init
(
int32& SampleRate |
MediaSoundComponent.h |