getContext
Returns the shared AudioContext, creating it on first call. All @web-kits/audio functions route through this single context.
import { getContext } from "@web-kits/audio";
const ctx = getContext();Signature
function getContext(options?: ContextOptions): AudioContext;ContextOptions
Configure the context on first creation. Options are ignored on subsequent calls.
| Property | Type | Description |
|---|---|---|
latencyHint | string | "interactive", "balanced", "playback" |
sampleRate | number | Output sample rate |
dispose
Close the shared context and release resources. A fresh context is created on the next getContext() call.
import { dispose } from "@web-kits/audio";
dispose();