Logo Mibo

AudioService Type

The MonoGame-backed IAudio: pipeline/loose-file sound and music registration, an 8-instance ring per sound, the single MediaPlayer music channel, 3D audio, and the fade state machine driven by IAudio.Tick.

Register entries right after the host registers the service (the MonoGameProgram.withBank builder does this for MVU programs) — the assets load at that point, before user init runs. A missing pipeline asset throws there, at startup, where a configuration mistake belongs.

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

AudioService(content)

Full Usage: AudioService(content)

Parameters:
Returns: AudioService
content : ContentManager
Returns: AudioService

Instance members

Instance member Description

this.Dispose

Full Usage: this.Dispose

Disposes the instance ring and the loose-file sounds and songs. Pipeline assets stay owned by the ContentManager.

this.RegisterMusic

Full Usage: this.RegisterMusic

Parameters:
    key : string - The game-vocabulary key to start the track with (e.g. "overworld").
    source : Source - The Source to load from.

Registers a music track from a pipeline asset or a loose file. Loading a key twice keeps the first registration.

key : string

The game-vocabulary key to start the track with (e.g. "overworld").

source : Source

The Source to load from.

this.RegisterSound

Full Usage: this.RegisterSound

Parameters:
    key : string - The game-vocabulary key to play the sound with (e.g. "jump").
    source : Source - The Source to load from.

Registers a sound effect from a pipeline asset or a loose WAV file. Loading a key twice keeps the first registration.

key : string

The game-vocabulary key to play the sound with (e.g. "jump").

source : Source

The Source to load from.

this.Tick

Full Usage: this.Tick

Parameters:
    dt : float32 - Elapsed seconds since the last frame.

Advances music fades and 3D re-attenuation by one frame. The host calls this every frame; calling it yourself double-steps the fades.

dt : float32

Elapsed seconds since the last frame.

Type something to start searching.