/** * PCM capture shared by the browser-direct adapters (ADR 0005): * `AudioContext` at 16 kHz, the capture worklet, Float32 -> PCM16 with clamp, * fixed-size chunks, a bounded queue that counts dropped chunks, freeze and * release. Chunk encoding and the socket stay in the adapter (options). */ export declare const PCM_SAMPLE_RATE = 16000; export interface PcmCaptureOptions { chunkSamples: number; maxQueuedChunks: number; /** Encodes the first `length` samples into one outbound chunk. */ encode: (samples: Int16Array, length: number, final: boolean) => T; canSend: () => boolean; send: (chunk: T) => void; /** End of an overflow episode, with the total dropped duration. */ onDropped: (seconds: number) => void; /** Each chunk dropped from the full queue, as it happens. */ onChunkDropped?: () => void; } export declare class PcmCapture { private readonly options; /** While frozen, worklet frames are dropped. */ frozen: boolean; private audioContext; private source; private workletNode; private workletUrl; private readonly pcm; private pcmLength; private queue; private droppedChunks; /** * Framer that hands every chunk to `send` synchronously, as it is produced: * no queue, so nothing can be dropped (Whisper buffers on its own). */ static passThrough(options: { chunkSamples: number; encode: PcmCaptureOptions["encode"]; send: (chunk: T) => void; onChunkDropped?: () => void; }): PcmCapture; constructor(options: PcmCaptureOptions); /** True once the worklet is wired to the stream. */ get ready(): boolean; /** * Builds the pipeline. When `aborted()` is true after the module load (a * stop raced the start) nothing is wired; the caller then calls `release()`. */ start(mediaStream: MediaStream, aborted: () => boolean): Promise; /** Converts one worklet frame; every full chunk is sent or queued. */ handleFrame(frame: Float32Array): void; /** Encodes the pending samples (possibly none) and empties the buffer. */ takeChunk(final: boolean): T; /** Seconds of audio waiting in the queue. */ get queuedSeconds(): number; /** Queues (or sends) the samples of a partial chunk, if any. */ enqueuePending(): void; /** Sends queued chunks while possible; an emptied queue ends a drop episode. */ flush(): void; /** Drops queued and buffered audio. */ discard(): void; /** Tears the pipeline down. */ release(): Promise; private enqueue; private endDropEpisode; } //# sourceMappingURL=PcmCapture.d.ts.map