UNPKG

murmuraba

Version:

Real-time audio noise reduction with advanced chunked processing for web applications

64 lines 1.75 kB
/** * Optimized Gain Management Service * Reduces re-renders and provides centralized gain control */ export interface GainServiceOptions { initialGain?: number; throttleMs?: number; enableSmoothing?: boolean; smoothingTimeConstant?: number; } export declare class GainService { private gainController; private gainNode?; private audioContext?; private throttleTimer?; private pendingGain?; private readonly throttleMs; private readonly enableSmoothing; private readonly smoothingTimeConstant; private updateListeners; constructor(options?: GainServiceOptions); /** * Initialize the service with an audio context */ initialize(audioContext: AudioContext): void; /** * Get the gain node for audio graph connection */ getGainNode(): GainNode | undefined; /** * Set gain with throttling to prevent excessive updates */ setGain(gain: number): void; /** * Get current gain value */ getCurrentGain(): number; /** * Apply gain preset */ applyPreset(preset: 'LOW' | 'NORMAL' | 'HIGH' | 'BOOST'): void; /** * Get gain description for UI */ getDescription(): string; /** * Get gain in decibels for display */ getDbValue(): number; /** * Subscribe to gain changes */ onGainChange(callback: (gain: number) => void): () => void; /** * Cleanup resources */ destroy(): void; private createGainNode; private applyPendingGain; private notifyListeners; } export declare function getGainService(options?: GainServiceOptions): GainService; export declare function destroyGainService(): void; //# sourceMappingURL=gain-service.d.ts.map