AudioService Type
The raylib-backed IAudio: file-path sound/music registration, an 8-alias ring per sound, a single music channel, and the fade state machine driven by IAudio.Tick.
Register entries right after the host registers the service (the
RaylibProgram.withBank builder does this for MVU programs) — sounds
load into memory at that point, before user init runs.
Paths resolve against the game's asset base path when the program set one
with withAssetsBasePath, the same rule as the asset service. File
formats: WAV, OGG, MP3, FLAC, QOA (whatever the raylib build decodes).
Fades interpolate the music channel volume through the Core Fade.volume helper. A fade to (or below) zero stops the music when it completes. The volume a fade-in returns to is the last one passed to AudioService.SetMusicVolume (1.0 if never set). A newly started track cancels any running fade and starts at that same volume — a fade-out ends the track that was playing, it is not a sticky volume.
Constructors
| Constructor |
Description
|
Full Usage:
AudioService(baseAssetPath)
Parameters:
string voption
Returns: AudioService
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.Dispose
|
Unloads every registered sound, alias, and music stream. |
Full Usage:
this.MusicVolume
Returns: float32
|
The current music slider value — the volume a fade-in returns to.
|
Full Usage:
this.RegisterMusic
Parameters:
string
-
The game-vocabulary key to start the track with (e.g. "overworld").
path : string
-
File path (relative to the program's asset base path when one is set).
|
Registers a music track from a file path. Loading a key twice keeps the first registration. A file that fails to load is skipped (raylib logs a warning) — the key plays nothing.
|
Full Usage:
this.RegisterSound
Parameters:
string
-
The game-vocabulary key to play the sound with (e.g. "jump").
path : string
-
File path (relative to the program's asset base path when one is set).
|
Registers a sound effect from a file path. Loading a key twice keeps the first registration. A file that fails to load is skipped (raylib logs a warning) — its key plays nothing.
|
Full Usage:
this.Tick
Parameters:
float32
-
Elapsed seconds since the last frame.
|
Advances music streaming and fade interpolation by one frame. The host calls this every frame; calling it yourself double-steps the music.
|
Mibo