import type { SynthesisEngine, SynthesisRequest } from "../engine/types.js"; import type { PcmAudio } from "../platform.js"; import type { RpcEndpoint } from "./protocol.js"; export interface WorkerSynthesisEngineOptions { /** * Sample rate reported before `load()` has answered. * * @defaultValue 24000 (Chatterbox) */ sampleRate?: number; /** Engine name reported before `load()` has answered. */ name?: string; /** Receives progress events pushed by the worker (model download, ready). */ onProgress?: (progress: Record) => void; /** * How long to wait for a reply before failing. `0` waits forever. * * @defaultValue 0 */ timeoutMs?: number; } /** * Main-thread {@link SynthesisEngine} that forwards every call to an engine * running inside a Web Worker. * * ```ts * const worker = new Worker(new URL("./tts.worker.ts", import.meta.url), { type: "module" }); * const engine = new WorkerSynthesisEngine(worker); * const tts = await VoxShot.create({ engine }); * ``` * * Audio crosses the boundary as a transferable buffer, but always as a copy — * the caller's `Float32Array` is never detached. */ export declare class WorkerSynthesisEngine implements SynthesisEngine { #private; constructor(endpoint: RpcEndpoint, options?: WorkerSynthesisEngineOptions); /** Name of the worker side engine; known accurately after `load()`. */ get name(): string; /** Sample rate of the worker side engine; known accurately after `load()`. */ get sampleRate(): number; load(device: "webgpu" | "wasm"): Promise; embed(audio: PcmAudio): Promise; synthesize(request: SynthesisRequest): Promise; dispose(): Promise; /** * Stop listening and fail every in-flight call. The worker itself is not * terminated — its lifetime belongs to whoever created it. */ disconnect(): void; } //# sourceMappingURL=worker-engine.d.ts.map