/** * Shared audio state — the internal surface every other audio module * (procedural, playback) builds on. Holds the cross-module mutable state * and the thin wrappers over the backend's global surface, so the public * modules stay backend-agnostic. * * The backend implementation itself lives in `./backend/`. * * Not part of the public `me.audio.*` API — the two getters * `getAudioContext` / `getMasterGain` are re-exported from `audio.ts` * for end users; everything else (the `state` object, `soundLoadError`) * is internal. */ /** * Whether to stop on an audio loading error. * * When `true`, melonJS throws an exception and aborts loading. * When `false`, melonJS disables sound and logs a warning to the console. * * Read-only through the `me.audio` namespace (module namespace properties * can't be assigned) — change it with {@link setStopOnAudioError}. * @default true * @see setStopOnAudioError */ export declare let stopOnAudioError: boolean; /** * Set the {@link stopOnAudioError} flag — whether an audio clip that still * fails after its retries aborts loading (reporting the error to the loader, * which rejects the preload) or just disables sound with a console warning. * This setter is the supported way to change the flag: assigning * `me.audio.stopOnAudioError = false` directly throws a TypeError, because * module namespace properties are read-only. * @param value - `true` to fail the load on error, `false` to disable sound instead * @example * // don't abort the whole game when audio fails to load * me.audio.setStopOnAudioError(false); * @category Audio */ export declare function setStopOnAudioError(value: boolean): void; /** * Returns the underlying WebAudio `AudioContext` used by the audio * module (the same one shared with file-based playback), or `null` if * audio is disabled or no compatible WebAudio implementation is * available. * * Use this when you need to build a custom WebAudio graph — procedural * SFX, custom filters / spatial nodes, audio analysis — without * spawning a second context. Browsers throttle or refuse multiple * `AudioContext` instances on the same page and each has its own * suspend-until-gesture state, so sharing matters. * * The context is lazily created on first access; the call also returns * the cached instance on every subsequent call. * @category Audio */ export declare function getAudioContext(): AudioContext | null; /** * Return the audio module's master gain node — the single `GainNode` * every playback path runs through on its way to `ctx.destination`, * and the lever that {@link setVolume} / {@link muteAll} manipulate. * * Connect to this node (instead of `ctx.destination`) whenever you * build a custom WebAudio graph and want the result to respect the * engine's mute / volume state. Returns `null` when audio is disabled * or unavailable. * @category Audio */ export declare function getMasterGain(): GainNode | null; //# sourceMappingURL=state.d.ts.map