IAudio Type
The backend-neutral audio service. Every windowed host registers one under
this interface before user init runs; resolve it with
GameContext.getService<IAudio> ctx (the MVU Cmd helpers and the
adaptive intent helpers do this for you and no-op when it is absent).
Sound effects overlap: each key owns a small pool of playback slots, so playing the same key several times per frame layers the copies. Music is a single channel — starting a track replaces the one playing.
Unknown keys are silent no-ops, so headless programs and test runs never need an audio device.
Example
let audio = GameContext.getService<IAudio> ctx
audio.Play "jump"
audio.PlayMusic "overworld" // loops
audio.FadeMusic(0.0f, 1.5f) // fade out over 1.5 s, then stop
Instance members
| Instance member |
Description
|
Full Usage:
this.FadeMusic
Parameters:
float32
-
The volume to reach (0.0 = fade out and stop).
seconds : float32
-
Fade duration in seconds; zero or less jumps straight to the target.
Modifiers: abstract |
Fades the music volume to targetVolume over seconds. A fade to (or below) zero stops the music when it completes; a fade to a positive volume leaves it playing.
|
Full Usage:
this.MusicPosition
Returns: float32
Modifiers: abstract |
The music playback position in seconds.
|
Full Usage:
this.MusicVolume
Returns: float32
The music slider value, 0.0..1.0.
Modifiers: abstract |
The music volume — the current value of the music slider, as set through IAudio.SetMusicVolume (1.0 if never set). This is the volume a fade with no explicit target returns to, so the MVU
|
Full Usage:
this.PauseMusic
Modifiers: abstract |
Pauses the music at the current position. |
Plays the sound registered under key with per-play knobs.
|
|
Full Usage:
this.Play
Parameters:
string
-
The game-vocabulary key the sound was registered under (e.g. "jump").
Modifiers: abstract |
Plays the sound registered under key with the default voice.
|
Full Usage:
this.PlayMusic
Parameters:
string
Modifiers: abstract |
Plays the music registered under key, looping — the background-music case. Replaces the track that is playing.
|
Full Usage:
this.PlayMusicOnce
Parameters:
string
Modifiers: abstract |
Plays the music registered under key once through, then stops. Replaces the track that is playing.
|
Full Usage:
this.ResumeMusic
Modifiers: abstract |
Resumes the music from where it was paused. |
Full Usage:
this.SeekMusic
Parameters:
float32
-
The position to jump to, counted from the track start.
Modifiers: abstract |
Seeks the music to an absolute time in seconds.
|
Full Usage:
this.SetMasterVolume
Parameters:
float32
-
Master volume (1.0 = full). Values outside 0.0..1.0 clamp.
Modifiers: abstract |
Sets the master volume that scales the whole mix — every sound effect and the music channel — live, on sounds that are already playing too. Rule on both backends: master volume is the one knob above everything; per-backend engines apply it differently, the services make them behave the same. Music volume is set separately with IAudio.SetMusicVolume.
|
Full Usage:
this.SetMusicVolume
Parameters:
float32
-
Music volume (1.0 = full, 0.0 = silent).
Modifiers: abstract |
Sets the music volume live — the music slider. This is also the volume a later fade-in returns to.
|
Full Usage:
this.StopAllSounds
Modifiers: abstract |
Stops every playing sound effect. Music keeps playing. |
Full Usage:
this.StopMusic
Modifiers: abstract |
Stops the music and resets it to its start. |
Full Usage:
this.Tick
Parameters:
float32
-
Elapsed seconds since the last frame.
Modifiers: abstract |
Advances music streaming and fade interpolation by one frame. The windowed hosts call this every frame; calling it yourself double-steps the music.
|
Mibo