MetaSoundComponent
MetaSoundComponent — a placeable MetaSound voice on an entity. Mirrors AudioSourceComponent's lifecycle contract: the AudioSystem resolves the .metasound graph on the first tick that sees the path, spins up a MetaSoundVoice on the chosen bus, seeds its control-input defaults, plays it when playOnCreate is set, follows the entity's transform while spatial, and tears the voice down when the component (or entity) goes away. Play/Stop/ SetInput/Trigger post requests the AudioSystem drains onto the live voice, so gameplay drives a running graph exactly like it drives a SoundCue.
- Module
- Audio
- Header
#include "Audio/Components/MetaSoundComponent.h"- Namespace
Mowo- Reflection
- Reflected by MowoHeaderTool
Properties
| Type | Name | Description |
|---|---|---|
bool | enabled | Default true. |
std::string | metaSoundPath | A .metasound graph asset. Resolved through the resolver the asset layer installs (Game), or straight off the VFS in headless hosts. |
std::string | bus | Default "SFX". |
float | volume | Default 1.0f. |
bool | spatial | Default true. |
bool | playOnCreate | Default false. |
std::vector<FMetaSoundInputDefault> | controlInputs | Seeded onto the voice once, right after it initializes. |
std::vector<FMetaSoundParameterLink> | parameterLinks | |
MetaSoundVoice* | voice | Runtime state (managed by AudioSystem). Default nullptr. |
bool | resolveAttempted | Default false. |
bool | initialized | Default false. |
bool | playRequested | Default false. |
bool | stopRequested | Default false. |
std::vector<FMetaSoundInputDefault> | pendingInputs | |
std::vector<std::string> | pendingTriggers | |
Vec3 | prevPosition |
Public functions
| Returns | Name | Description |
|---|---|---|
void | Play | Post a play/stop the AudioSystem services next tick. |
void | Stop | |
void | SetInput | Queue a control-input write. |
void | Trigger | Queue a trigger pulse for the named graph input. |
Function details
Play
void Play()Post a play/stop the AudioSystem services next tick. Play cancels a pending stop and vice-versa so the last call in a frame wins.
Stop
void Stop()SetInput
void SetInput(const std::string& inputName, float value)Queue a control-input write. A later write to the same input overwrites the earlier one, so a frame that sets an input twice ships one value.
Trigger
void Trigger(const std::string& inputName)Queue a trigger pulse for the named graph input.