export interface EventListener { callback: Function; once: boolean; } /** * Manages the lifecycle of audio source nodes, including creation, connection, * destruction, and automatic event listener management. */ export declare class AudioSourceController { private currentSource; private mediaElementSource; private endedHandler; private gainNode; private audioContext; private eventListeners; constructor(audioContext: AudioContext, gainNode: GainNode); /** * Set the source node and establish connections and event listeners. */ setSource(source: AudioBufferSourceNode | HTMLAudioElement): void; /** * Get the current source node. */ getSource(): AudioBufferSourceNode | HTMLAudioElement | null; /** * Refresh the source node with a new one, preserving connections and event listeners. */ refreshSource(newSource: AudioBufferSourceNode | HTMLAudioElement): void; /** * Disconnect the current source node and clear event listeners. */ disconnectSource(): void; /** * Setup event listeners for the current source node. */ private setupEventListeners; /** * Remove all event listeners from the current source node. */ private removeAllEventListeners; /** * Emit an event to all registered listeners. */ emit(event: string): void; /** * Add an event listener. */ on(event: string, callback: Function): void; /** * Remove an event listener. */ off(event: string, callback: Function): void; /** * Add a one-time event listener. */ once(event: string, callback: Function): void; /** * Stop the current source node. */ stop(): void; /** * Destroy the controller and release all resources. */ destroy(): void; /** * Start the current source node. */ start(when?: number, offset?: number): void; /** * Pause the current source node. */ pause(): void; }