API

Interface AudioEngine

A Babylon Lite audio engine. Pure state — operate on it with the audio functions (createSoundAsync, setMasterVolume, disposeAudioEngine, …).

interface AudioEngine {
    audioContext: BaseAudioContext;
    currentTime: number;
    onStateChanged: AudioSignal<AudioEngineState>;
    onUserGesture: AudioSignal<void>;
    state: AudioEngineState;
}
Index
audioContext: BaseAudioContext

The underlying Web Audio context. Use it to build custom source nodes (oscillators, buffers, filters) and route them into the engine via createSoundSourceAsync, so they share the engine's master bus, unlock handling, and master volume. Typed as BaseAudioContext because an OfflineAudioContext may back the engine for deterministic rendering.

currentTime: number

The audio context's current time, in seconds.

onStateChanged: AudioSignal<AudioEngineState>

Fires whenever state changes.

onUserGesture: AudioSignal<void>

Fires on every qualifying user gesture (click), not just the first.

Current context state. Always "running" for an offline context.