Navigation
API > API/Plugins > API/Plugins/HarmonixMetasound
A music source driven by a Metasound's MIDI clock output.
Connects to a Metasound via UAudioComponent, reads the MIDI clock history ring buffer produced by the audio render thread, and smooths it into a game-thread-rate position suitable for gameplay.
Produces a single time stream: the smoothed audio render position. Calibration offsets (experienced time, video render time) should be applied externally via UOffsetMusicSource.
State is derived from the Metasound's actual transport state, not from explicit Start/Stop calls. If the AudioComponent starts playing externally, the source detects it and reports Running. Transport methods on IMusicSource are no-ops — control the Metasound through its AudioComponent or Metasound interfaces directly.
Reports Preparing when connected to an AudioComponent but the generator is not yet attached or no clock history is available.
| Name | UMetasoundMusicSource |
| Type | class |
| Header File | /Engine/Plugins/Runtime/Harmonix/Source/HarmonixMetasound/Public/HarmonixMetasound/MusicSource/MetasoundMusicSource.h |
| Include Path | #include "HarmonixMetasound/MusicSource/MetasoundMusicSource.h" |
Syntax
UCLASS (MinimalAPI, BlueprintType)
class UMetasoundMusicSource :
public UObject ,
public IMusicSource
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UMetasoundMusicSource
Implements Interfaces
Structs
| Name | Remarks |
|---|---|
| FSmoothedClockState |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| kFramesOfErrorHistory | const int | HarmonixMetasound/MusicSource/MetasoundMusicSource.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AudioComponentToWatch | TWeakObjectPtr< UAudioComponent > | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| bLoopDetected | bool | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| bSeekDetected | bool | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| CachedSourceState | Harmonix::ESourceState | Cached source state, derived from clock history transport each frame. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
| ClockHistory | UMidiClockUpdateSubsystem::FClockHistoryPtr | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| CurrentAdvanceRate | float | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| CurrentGeneratorHandle | TStrongObjectPtr< UMetasoundGeneratorHandle > | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| CurrentMapChain | TSharedPtr< const HarmonixMetasound::Analysis::FSongMapChain > | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| CurrentPos | FMidiSongPos | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| DeltaSecondsBetweenRefreshes | double | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| ErrorTracker | FLocalMinimumMagnitudeTracker< double, kFramesOfErrorHistory > | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| GeneratorAttachedCallbackHandle | FDelegateHandle | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| GeneratorDetachedCallbackHandle | FDelegateHandle | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| GeneratorIOUpdatedCallbackHandle | FDelegateHandle | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| GraphChangedCallbackHandle | FDelegateHandle | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| LastRefreshWallClockTimeSeconds | double | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| LastTickSeen | int32 | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| MetasoundOutputName | FName | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| MidiSongPosAnalyzerAddress | Metasound::Frontend::FAnalyzerAddress | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| OnAttachedDelegate | UMetasoundGeneratorHandle::FOnAttached::FDelegate | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| OnDetachedDelegate | UMetasoundGeneratorHandle::FOnDetached::FDelegate | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| PrevPos | FMidiSongPos | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| RenderSmoothingLagSeconds | float | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| RenderStartSampleCount | Metasound::FSampleCount | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| RenderStartWallClockTimeSeconds | double | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| SmoothedClockHistoryCursor | HarmonixMetasound::Analysis::FMidiClockSongPositionHistory::FReadCursor | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| SmoothedState | FSmoothedClockState | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| SyncSpeed | double | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
| UnderlyingGenerator | TWeakPtr< Metasound::FMetasoundGenerator > | HarmonixMetasound/MusicSource/MetasoundMusicSource.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool ConnectToAudioComponent
(
UAudioComponent* InAudioComponent, |
Connect to a Metasound on an audio component. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
void Disconnect() |
Disconnect from the Metasound and release all handles. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h |
Public Virtual
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginDestroy() |
HarmonixMetasound/MusicSource/MetasoundMusicSource.h |
Overridden from IMusicSource
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Continue() |
HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
virtual float GetCurrentClockAdvanceRate() |
The current playback speed multiplier. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual const ISongMapEvaluator * GetCurrentSongMapEvaluator() |
The song maps used to convert between time and musical position. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual const FMidiSongPos & GetCurrentSongPos() |
The current musical position, updated once per frame via Update(). | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual FString GetDisplayName() |
HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
virtual Harmonix::ESourceEvent GetLatestSourceEvent() |
Get the most recent source event for this frame (Start, Advance, Stop, Pause, Continue, Seek, Loop). | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual float GetLoopLengthMs() |
Length of the loop region in milliseconds. Only valid if IsLooping() is true. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual float GetLoopStartMs() |
Start of the loop region in milliseconds. Only valid if IsLooping() is true. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual const FMidiSongPos & GetPreviousSongPos() |
The previous frame's musical position. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual Harmonix::ESourceState GetSourceState() |
Get the current transport state of the source (Stopped, Preparing, Paused, Running). | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual bool IsLooping() |
Whether this source is currently looping. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual bool LoopedThisFrame() |
Whether the source crossed a loop boundary this frame. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual void Pause() |
HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
virtual bool SeekedThisFrame() |
Whether the source performed a non-contiguous time jump (seek) this frame. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual void Start () |
- Transport Controls - The source owns playback. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual void Stop() |
HarmonixMetasound/MusicSource/MetasoundMusicSource.h | ||
virtual TOptional< FVector > TryGetAudioSourceLocation() |
Get the world-space location of the audio source, if available. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h | |
virtual void Update () |
Called once per frame by the update subsystem. | HarmonixMetasound/MusicSource/MetasoundMusicSource.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FString HistoryFailureTypeToString
(
EHistoryFailureType Error |
HarmonixMetasound/MusicSource/MetasoundMusicSource.h |