/** * AudioRenderer - Web Audio API based audio playback with precise clock synchronization * Uses AudioContext as the master clock for A/V sync (60Hz smooth playback) */ import type { PCMFrame } from "../decode/SoftwareAudioDecoder"; export declare class AudioRenderer { private audioContext; private inputNode; private gainNode; private compressorNode; private scheduledTime; private isPlaying; private volume; private _playbackRate; private activeSources; private _muted; private droppedWhileSuspended; private firstBufferScheduledAt; private firstBufferMediaTime; private hasFirstBuffer; private _lastUnderrunAt; private _ducked; /** Output held silent across the unmute re-read — see silenceForResync. */ private _resyncSilenced; private static readonly DUCK_FADE_OUT; private static readonly DUCK_FADE_IN; private static readonly DUCK_CLEAR_MS; private _suppressDuckUntil; private currentMediaTime; private maxScheduledMediaTime; private lastDecodeTime; private scheduledCount; private isRebufferingForRateChange; private preservePitch; private signalsmith; private signalsmithLoading; private signalsmithSampleRate; private _decodedSampleRate; private _stableAudio; /** The state the GRAPH is actually wired for, so a repeated request for the * state we are already in doesn't tear the chain apart to rebuild it * identically — see setStableAudio. */ private _wiredStableAudio; private _sinkId; private static readonly GAIN_RAMP_TIME; private static readonly FADE_OUT_TIME; private contextStateHandler; /** * Latches sharedContextActivated the moment the context reaches "running". * Separate from contextStateHandler on purpose: that one is stable audio's * recovery monitor and is only wired when stable audio is on, while "audio * got unlocked this session" is a fact every path needs — see init(). */ private contextActivationHandler; private recoveryAttempts; private static readonly MAX_RECOVERY_ATTEMPTS; private starvationStartTime; private isStarved; private static readonly STARVATION_THRESHOLD; private keepaliveEl; private keepaliveUrl; constructor(); /** * Lazily create a near-silent looping