Interface AudioEngine
interface AudioEngine {
audioContext: BaseAudioContext;
currentTime: number;
onStateChanged: AudioSignal<AudioEngineState>;
onUserGesture: AudioSignal<void>;
state: AudioEngineState;
}
audioContext: BaseAudioContext;
currentTime: number;
onStateChanged: AudioSignal<AudioEngineState>;
onUserGesture: AudioSignal<void>;
state: AudioEngineState;
}
Properties
Readonlyaudio Context
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.
Readonlycurrent Time
currentTime: number
The audio context's current time, in seconds.
Readonlyon State Changed
Fires whenever state changes.
Readonlyon User Gesture
Fires on every qualifying user gesture (click), not just the first.
Readonlystate
Current context state. Always "running" for an offline context.
A Babylon Lite audio engine. Pure state — operate on it with the audio functions (
createSoundAsync,setMasterVolume,disposeAudioEngine, …).