/** One reserved playback slot, including sources still loading. */ export interface AudioVoice { id: number; soundId: string; priority: number; } /** Detached allocator state; ids increase monotonically for deterministic oldest-first ties. */ export interface VoiceAllocatorSnapshot { nextId: number; voices: AudioVoice[]; } /** Caller-owned reservation storage. Reads and writes use detached state. */ export interface VoiceAllocatorStorage { read(): VoiceAllocatorSnapshot; write(state: VoiceAllocatorSnapshot): void; } /** Playback budget. Zero disables playback; default 64. */ export interface VoiceAllocatorConfig { maxTotal?: number; /** At capacity, steal the lowest-priority oldest voice, or reject new voices. Default "steal-lowest". */ overflow?: "steal-lowest" | "reject"; storage?: VoiceAllocatorStorage; } /** Admission result; stop every stolen source before starting the admitted voice. */ export type VoiceAllocation = { ok: false; } | { ok: true; voiceId: number; stolen: number[]; }; /** Bounded reservations with higher-priority protection and oldest-first ties. */ export interface VoiceAllocator { request(soundId: string, priority?: number, maxVoices?: number): VoiceAllocation; release(voiceId: number): void; snapshot(): VoiceAllocatorSnapshot; restore(state: VoiceAllocatorSnapshot): void; /** Return reservations removed to meet the new limit; the playback owner stops them. */ retune(config: Pick): number[]; } /** * Reserve bounded sound playback before fetching or constructing a graph. Equal priorities steal * the oldest reservation; lower priorities cannot interrupt higher priorities. Policy is retunable. * @capability audio-voice-budget bound simultaneous sound playback with per-sound caps, priorities, and deterministic stealing */ export declare function createVoiceAllocator(config?: VoiceAllocatorConfig): VoiceAllocator;