Navigation
API > API/Plugins > API/Plugins/HarmonixMetasound
An IMusicSource that reads from a parent IMusicSource and applies a millisecond offset. This is how calibrated time clocks (experienced, video render) are created:
UMetasoundMusicSource (audio render) -> UOffsetMusicSource (-30ms) -> UMusicClock (video render) -> UOffsetMusicSource (-50ms) -> UMusicClock (experienced)
Offset sources can also chain: SourceA -> OffsetB -> OffsetC, where each offset reads directly from the previous IMusicSource.
Loop handling: when the parent source is looping, the offset time is wrapped around the loop boundary. On the first pass through the loop (before the parent has ever looped), negative offsets are NOT wrapped — the offset time stays negative until the parent advances past the threshold.
| Name | UOffsetMusicSource |
| Type | class |
| Header File | /Engine/Plugins/Runtime/Harmonix/Source/HarmonixMetasound/Public/HarmonixMetasound/MusicSource/OffsetMusicSource.h |
| Include Path | #include "HarmonixMetasound/MusicSource/OffsetMusicSource.h" |
Syntax
UCLASS (MinimalAPI, BlueprintType)
class UOffsetMusicSource :
public UObject ,
public IMusicSource
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UOffsetMusicSource
Implements Interfaces
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bLoopedThisFrame | bool | HarmonixMetasound/MusicSource/OffsetMusicSource.h | ||
| bParentHasLooped | bool | True once the parent source has completed at least one loop pass. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
| bSeekedThisFrame | bool | HarmonixMetasound/MusicSource/OffsetMusicSource.h | ||
| CurrentPos | FMidiSongPos | HarmonixMetasound/MusicSource/OffsetMusicSource.h | ||
| OffsetMs | float | HarmonixMetasound/MusicSource/OffsetMusicSource.h | ||
| ParentSourceCache | IMusicSource * | Cached interface pointer — valid only when ParentSourceObject is valid. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
| ParentSourceObject | TWeakObjectPtr< UObject > | Weak reference to the parent source UObject. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
| PrevPos | FMidiSongPos | HarmonixMetasound/MusicSource/OffsetMusicSource.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
float GetOffsetMs() |
Get the current offset. | HarmonixMetasound/MusicSource/OffsetMusicSource.h |
|
TScriptInterface< IMusicSource > GetParentSource() |
Get the parent source. | HarmonixMetasound/MusicSource/OffsetMusicSource.h |
|
void SetOffsetMs
(
float InOffsetMs |
Set the offset in milliseconds. Positive = ahead, negative = behind. | HarmonixMetasound/MusicSource/OffsetMusicSource.h |
|
void SetParentSource
(
const TScriptInterface< IMusicSource >& InParentSource |
Set the parent source this offset reads from. | HarmonixMetasound/MusicSource/OffsetMusicSource.h |
|
Public Virtual
Overridden from IMusicSource
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Continue() |
HarmonixMetasound/MusicSource/OffsetMusicSource.h | ||
virtual float GetCurrentClockAdvanceRate() |
The current playback speed multiplier. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual const ISongMapEvaluator * GetCurrentSongMapEvaluator() |
The song maps used to convert between time and musical position. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual const FMidiSongPos & GetCurrentSongPos() |
The current musical position, updated once per frame via Update(). | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual FString GetDisplayName() |
HarmonixMetasound/MusicSource/OffsetMusicSource.h | ||
virtual Harmonix::ESourceEvent GetLatestSourceEvent() |
Get the most recent source event for this frame (Start, Advance, Stop, Pause, Continue, Seek, Loop). | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual float GetLoopLengthMs() |
Length of the loop region in milliseconds. Only valid if IsLooping() is true. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual float GetLoopStartMs() |
Start of the loop region in milliseconds. Only valid if IsLooping() is true. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual const FMidiSongPos & GetPreviousSongPos() |
The previous frame's musical position. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual Harmonix::ESourceState GetSourceState() |
Get the current transport state of the source (Stopped, Preparing, Paused, Running). | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual bool IsLooping() |
Whether this source is currently looping. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual bool LoopedThisFrame() |
Whether the source crossed a loop boundary this frame. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual void Pause() |
HarmonixMetasound/MusicSource/OffsetMusicSource.h | ||
virtual bool SeekedThisFrame() |
Whether the source performed a non-contiguous time jump (seek) this frame. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual void Start() |
Transport is a no-op — the parent source owns playback. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual void Stop() |
HarmonixMetasound/MusicSource/OffsetMusicSource.h | ||
virtual TOptional< FVector > TryGetAudioSourceLocation() |
Get the world-space location of the audio source, if available. | HarmonixMetasound/MusicSource/OffsetMusicSource.h | |
virtual void Update () |
Called once per frame by the update subsystem. | HarmonixMetasound/MusicSource/OffsetMusicSource.h |