MAudioPlayer
Object-oriented audio handle exposed to Visual Scripting. Every MFUNCTION below becomes a node in the Visual Script catalog (built from MClass function tables), so a graph can load a clip and drive its playback the same way gameplay C++ would. The wrapper owns one AudioSource, created lazily on the first Load / PlayOneShot; calls made before anything is loaded are safe no-ops, which keeps the nodes usable from a graph that runs before the audio engine is up.
- Module
- Audio
- Header
#include "Audio/MAudioPlayer.h"- Namespace
Mowo- Reflection
- Reflected by MowoHeaderTool
Constructors
| Signature | Name | Description |
|---|---|---|
MAudioPlayer() | MAudioPlayer | |
~MAudioPlayer() override | ~MAudioPlayer |
Public functions
| Returns | Name | Description |
|---|---|---|
bool | Load | Load a clip (VFS path) onto this component's voice, replacing any clip it already holds. |
void | Play | |
void | Stop | |
void | Pause | |
void | SetVolume | |
void | SetPitch | |
bool | IsPlaying | |
void | SetBus | Bus index into AudioBus (0 Master, 1 Music, 2 SFX, 3 Voice, 4 Ambient); out-of-range falls back to SFX. |
void | PlayOneShot | Fire-and-forget: plays clipPath once through the engine's one-shot pool on this component's bus, independent of the held voice. |
Function details
MAudioPlayer
MAudioPlayer()~MAudioPlayer
~MAudioPlayer() overrideLoad
bool Load(const std::string& clipPath)Load a clip (VFS path) onto this component's voice, replacing any clip it already holds. Returns false when the engine is down or the path fails.
Play
void Play()Stop
void Stop()Pause
void Pause()SetVolume
void SetVolume(float volume)SetPitch
void SetPitch(float pitch)IsPlaying
bool IsPlaying() constSetBus
void SetBus(int32_t bus)Bus index into AudioBus (0 Master, 1 Music, 2 SFX, 3 Voice, 4 Ambient); out-of-range falls back to SFX. Applies to the next Load / PlayOneShot.
PlayOneShot
void PlayOneShot(const std::string& clipPath)Fire-and-forget: plays clipPath once through the engine's one-shot pool on this component's bus, independent of the held voice. Cheaper than Load+Play for footstep-style triggers that never need to be stopped.