class

FMusicSystem

Module
Narrative
Header
#include "Narrative/MusicSystem.h"
Namespace
Mowo

Constructors

SignatureNameDescription
FMusicSystem()FMusicSystemBoth out-of-line: the stem stacks hold Scope<AudioSource>, and the header only forward-declares AudioSource.
~FMusicSystem() override~FMusicSystem
FMusicSystem(const FMusicSystem&) = deleteFMusicSystem

Public functions

ReturnsNameDescription
FMusicSystem&operator=
SystemPhaseGetPhaseLate: the score reacts to the director phase and the listener's zone, both of which settle earlier in the frame.
voidInitialize
voidUpdate
voidShutdown
voidSetScene
boolSetScoreLoads the score and enters its default state.
boolSetScoreAsset
const Ref<MusicAsset>&GetScore
std::stringGetScoreId
boolSetStateHonours the asset's transition rules: a disallowed target is rejected (returns false).
boolSetStateImmediate
const std::string&GetState
const std::string&GetPendingState
boolHasPendingState
boolIsCrossfading
floatGetCrossfadeRemaining
floatGetTimeToNextBarSeconds until the next bar line; 0 when the score carries no tempo.
floatGetBarPhase
floatGetBarSeconds
boolPlayStinger
uint32_tGetStingerPlayCount
const std::string&GetLastStinger
floatGetLayerGainLive gain of a stem after state gain, crossfade blend, duck and the music volume.
floatGetStateGain
boolSetLayerGainGate a layer of the active state without restarting it — the whole point of the shared start instant.
voidSetDuckDucking hook for dialogue and proximity voice.
floatGetDuck
floatGetDuckTarget
voidSetVolume
floatGetVolume
voidSetDirectorBindingAutomatic director binding only ever engages when the score carries Phase nodes — enabling it on a score without them is a no-op, which is what keeps hand-driven scores hand-driven.
boolIsDirectorBindingEnabled
boolIsDirectorDriving
const std::string&GetLastDirectorPhase
voidSetAmbienceResolverZone ambience beds: the listener's zone is polled at a low rate and the bed crossfades whenever the zone's ambience id changes.
voidSetAmbienceEnabled
boolIsAmbienceEnabled
const std::string&GetAmbienceId
boolSetAmbience
FMusicSystem*GetActive
boolResolveHudSource

Function details

FMusicSystem

C++
FMusicSystem()

Both out-of-line: the stem stacks hold Scope<AudioSource>, and the header only forward-declares AudioSource.

~FMusicSystem

C++
~FMusicSystem() override

FMusicSystem

C++
FMusicSystem(const FMusicSystem&) = delete

operator=

C++
FMusicSystem& operator=(const FMusicSystem&) = delete

GetPhase

C++
SystemPhase GetPhase() const override

Late: the score reacts to the director phase and the listener's zone, both of which settle earlier in the frame.

Initialize

C++
void Initialize(World* world) override

Update

C++
void Update(float deltaTime) override

Shutdown

C++
void Shutdown() override

SetScene

C++
void SetScene(Scene* scene)

SetScore

C++
bool SetScore(const std::string& idOrPath)

Loads the score and enters its default state. An empty path tears the current score down.

SetScoreAsset

C++
bool SetScoreAsset(const Ref<MusicAsset>& asset)

GetScore

C++
const Ref<MusicAsset>& GetScore() const

GetScoreId

C++
std::string GetScoreId() const

SetState

C++
bool SetState(const std::string& stateId)

Honours the asset's transition rules: a disallowed target is rejected (returns false). A quantized move is deferred to the next bar and reported as pending until it commits.

SetStateImmediate

C++
bool SetStateImmediate(const std::string& stateId)

GetState

C++
const std::string& GetState() const

GetPendingState

C++
const std::string& GetPendingState() const

HasPendingState

C++
bool HasPendingState() const

IsCrossfading

C++
bool IsCrossfading() const

GetCrossfadeRemaining

C++
float GetCrossfadeRemaining() const

GetTimeToNextBar

C++
float GetTimeToNextBar() const

Seconds until the next bar line; 0 when the score carries no tempo.

GetBarPhase

C++
float GetBarPhase() const

GetBarSeconds

C++
float GetBarSeconds() const

PlayStinger

C++
bool PlayStinger(const std::string& stingerId)

GetStingerPlayCount

C++
uint32_t GetStingerPlayCount() const

GetLastStinger

C++
const std::string& GetLastStinger() const

GetLayerGain

C++
float GetLayerGain(const std::string& stateId, const std::string& clipPath) const

Live gain of a stem after state gain, crossfade blend, duck and the music volume. -1 when the state or stem is not currently mounted.

GetStateGain

C++
float GetStateGain(const std::string& stateId) const

SetLayerGain

C++
bool SetLayerGain(const std::string& clipPath, float gain)

Gate a layer of the active state without restarting it — the whole point of the shared start instant.

SetDuck

C++
void SetDuck(float scale, float blendSeconds)

Ducking hook for dialogue and proximity voice. scale 1 = no duck.

GetDuck

C++
float GetDuck() const

GetDuckTarget

C++
float GetDuckTarget() const

SetVolume

C++
void SetVolume(float volume)

GetVolume

C++
float GetVolume() const

SetDirectorBinding

C++
void SetDirectorBinding(bool enabled)

Automatic director binding only ever engages when the score carries Phase nodes — enabling it on a score without them is a no-op, which is what keeps hand-driven scores hand-driven.

IsDirectorBindingEnabled

C++
bool IsDirectorBindingEnabled() const

IsDirectorDriving

C++
bool IsDirectorDriving() const

GetLastDirectorPhase

C++
const std::string& GetLastDirectorPhase() const

SetAmbienceResolver

C++
static void SetAmbienceResolver(bool (*resolver)(World*, EntityID, std::string& outAmbienceId))

Zone ambience beds: the listener's zone is polled at a low rate and the bed crossfades whenever the zone's ambience id changes. Which ambience the listener stands in. Zones belong to a gameplay kit, not to the music system, so the kit installs this; left null, ambience never changes on its own and only explicit SetAmbience calls move it. False means "no zones here", which leaves the current ambience alone.

SetAmbienceEnabled

C++
void SetAmbienceEnabled(bool enabled)

IsAmbienceEnabled

C++
bool IsAmbienceEnabled() const

GetAmbienceId

C++
const std::string& GetAmbienceId() const

SetAmbience

C++
bool SetAmbience(const std::string& ambienceId)

GetActive

C++
static FMusicSystem* GetActive()

ResolveHudSource

C++
static bool ResolveHudSource(const std::string& source, std::string& outText, double& outNumber, bool& outIsNumber)
Generated from Narrative/MusicSystem.h via narrative.json · Oct 26, 2026Version 1.0.0