import { ReadiumSpeechPlaybackEngine } from '../engine'; import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from '../navigator'; import { ReadiumSpeechUtterance } from '../utterance'; import { ReadiumSpeechVoice } from '../voices/types'; import { SpeechServerFormatOptions } from './selectFormat'; export interface SpeechServerEndpoints { voices: string; synthesize: string; service: string; } export interface SpeechServerEngineOptions { endpoints: SpeechServerEndpoints; fetch?: typeof fetch; prefetchWindow?: number; readyBufferChars?: number; overLengthText?: "split" | "error"; format?: SpeechServerFormatOptions; timeoutMs?: number; } export declare class SpeechServerEngine implements ReadiumSpeechPlaybackEngine { private endpoints; private fetchImpl; private currentVoice; private voices; private serviceInfo; private serviceInfoPromise; private currentUtterances; private currentUtteranceIndex; private playbackState; private readonly events; private speakInContentLanguage; private speakGeneration; private loadGeneration; private readonly prefetchWindow; private readonly readyBufferChars; private readonly overLengthText; private readonly timeoutMs; private readonly formatOptions; private readonly canPlayType; private prefetchCache; private prefetchChainTail; private activeControllers; private liveControllers; private isSpeakingInternal; private restartPending; private audioContext; private masterGain; private scheduledChunks; private boundaryRafHandle; private rate; private pitch; private volume; constructor(options: SpeechServerEngineOptions); setAvailableVoices(voices: ReadiumSpeechVoice[]): void; private fetchNetwork; loadUtterances(contents: ReadiumSpeechUtterance[], startIndex?: number): void; private bufferUntilReady; private indexCoveringChars; setVoice(voice: ReadiumSpeechVoice | string): void; getCurrentVoice(): ReadiumSpeechVoice | null; getAvailableVoices(): Promise; private getServiceInfo; private fetchServiceInfo; setSpeakInContentLanguage(enabled: boolean): void; getSpeakInContentLanguage(): boolean; speak(utteranceIndex?: number): void; private synthesizeAndPlay; private resolveSynthesisStream; private fillPrefetchWindow; private queuePrefetch; private clearPrefetchCache; private abortLiveControllers; private synthesizeStream; private synthesizeChunk; private ensureAudioContext; private awaitWithStallDeadline; private scheduleChunksStreaming; private handleUtteranceEnded; private startBoundaryPolling; private stopBoundaryPolling; private checkBoundaries; private stopAudio; pause(): void; resume(): void; stop(): void; setRate(rate: number): void; getRate(): number; setPitch(pitch: number): void; getPitch(): number; setVolume(volume: number): void; getVolume(): number; private scheduleRestartIfSpeaking; getState(): ReadiumSpeechPlaybackState; getCurrentUtteranceIndex(): number; setCurrentUtteranceIndex(index: number, onComplete?: (success: boolean) => void): void; getUtteranceCount(): number; on(event: ReadiumSpeechPlaybackEvent["type"], callback: (event: ReadiumSpeechPlaybackEvent) => void): () => void; private emitEvent; private setState; destroy(): Promise; }