Skip to content

AudioAPI reference

Namespace MicroEngine.Audio

Sound effects and music: the one mixer every backend plays through (voices with handles and priorities, buses, music streams, exact-frame scheduling), the sound bank and music games play through, the audio device contract, offline rendering for tests, WAV and OGG decoding, synthesis.

Guide: Audio

Namespaces

MicroEngine.Audio.Retro

Classes

AudioAssetLoaders

The audio loaders of the content store (Game.Assets.Sound, Game.Assets.Music): “sound” decodes a PCM WAV file into an AudioClip (“.wav”), and “music” reads a music file’s bytes as EncodedAudio (“.ogg”, “.mp3”; a “.wav” asked for as music too).

AudioBus

A named mix stage: the sounds and buses under it are scaled by its Volume. Buses form a tree under “master”: a bus is created under a parent that already exists and is never moved, so there is no cycle.

AudioClip

Uncompressed audio: interleaved float samples in -1..1.

AudioEngineSettings

Settings of an AudioEngine.

AudioEngine

The engine’s one mixer: game code plays sounds here on the main thread, a sink renders them. Every backend plays through it, so voices, priorities, stealing, buses and fades behave the same everywhere, and an offline sink renders exactly what a device would play.

AudioMixer

Game-facing audio: a sound bank keyed by name plus music with fades. Games register synthesized clips once and then call Play by name.

CaptureAudioDevice

An audio device that plays nothing aloud and records what would have been heard: the engine’s own mixer (MixerAudioDevice) rendering into an offline sink, one game step per Update (the game calls it once per update), so the same run always produces the same samples. Tests compare its Output (waves, durations, silences, amplitudes); the launcher’s –audio-capture FILE writes it as a WAV.

EncodedAudio

The bytes of a music file loaded from content (the “music” asset kind) and its format (“wav”, “ogg”, “mp3”): music is decoded while it plays rather than all at once.

MixerAudioDevice

An IAudioDevice over the engine’s one mixer (AudioEngine) and a PCM sink: every backend device is one of these with its own sink, so voices, priorities, stealing, music and fades behave the same everywhere. Music decodes in managed code: WAV, OGG Vorbis (streamed, decoded ahead outside the simulation step), and formats a backend adds (AddDecoder).

MusicHandle

An opaque handle to loaded, loopable music.

OfflineAudioSink

The test sink: renders into memory with no device and no clock. Each Pump renders exactly one simulation step of frames (the step’s share of the rate, so 44100 Hz at 60 steps alternates 735-frame steps exactly), in blocks of at most the block size, so the output depends only on what the game played, never on time.

SilentAudioDevice

Silent device used headlessly and as a fallback when no audio hardware is present.

SoundHandle

An opaque handle to a loaded sound effect.

Structs

AudioStatistics

What Statistics reports about the mixer’s voices.

PlayParameters

How a sound plays.

VoiceHandle

A sound playing in an AudioEngine: a voice slot and the generation of the sound that took it. Once the sound ends, is stopped or is stolen by the voice limit, the handle is stale and calls with it do nothing. default is None, which Play also returns for a sound the voice policy refused.

Interfaces

IAudioDevice

Backend audio device. Implementations must tolerate missing hardware by becoming silent.

IAudioStream

Streamed audio (music decoded while it plays). The engine reads it only in Pump, on the main thread outside the simulation step, ahead of the sink.