microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
68 lines (67 loc) • 4.54 kB
TypeScript
import { ConnectionEvent, EventSource, IAudioDestination, IConnection, IDisposable, ServiceEvent } from "../common/Exports.js";
import { AudioOutputFormatImpl } from "../sdk/Audio/AudioOutputFormat.js";
import { CancellationErrorCode, CancellationReason, SpeechSynthesisBookmarkEventArgs, SpeechSynthesisResult, SpeechSynthesisVisemeEventArgs, SpeechSynthesisWordBoundaryEventArgs, Synthesizer } from "../sdk/Exports.js";
import { AgentConfig, ISynthesisConnectionFactory, ISynthesisMetadata, SynthesisContext, SynthesisTurn, SynthesizerConfig } from "./Exports.js";
import { IAuthentication } from "./IAuthentication.js";
import { SpeechConnectionMessage } from "./SpeechConnectionMessage.Internal.js";
export declare abstract class SynthesisAdapterBase implements IDisposable {
protected privSynthesisTurn: SynthesisTurn;
protected privConnectionId: string;
protected privSynthesizerConfig: SynthesizerConfig;
protected privSynthesizer: Synthesizer;
protected privSuccessCallback: (e: SpeechSynthesisResult) => void;
protected privErrorCallback: (e: string) => void;
get synthesisContext(): SynthesisContext;
get agentConfig(): AgentConfig;
get connectionEvents(): EventSource<ConnectionEvent>;
get serviceEvents(): EventSource<ServiceEvent>;
protected speakOverride: (ssml: string, requestId: string, sc: (e: SpeechSynthesisResult) => void, ec: (e: string) => void) => void;
static telemetryData: (json: string) => void;
static telemetryDataEnabled: boolean;
set activityTemplate(messagePayload: string);
get activityTemplate(): string;
protected receiveMessageOverride: () => void;
protected connectImplOverride: (isUnAuthorized: boolean) => void;
protected configConnectionOverride: (connection: IConnection) => Promise<IConnection>;
set audioOutputFormat(format: AudioOutputFormatImpl);
private privAuthentication;
private privConnectionFactory;
private privConnectionConfigurationPromise;
private privConnectionPromise;
private privAuthFetchEventId;
private privIsDisposed;
private privConnectionEvents;
private privServiceEvents;
protected privSynthesisContext: SynthesisContext;
private privAgentConfig;
private privActivityTemplate;
protected privAudioOutputFormat: AudioOutputFormatImpl;
private privSessionAudioDestination;
constructor(authentication: IAuthentication, connectionFactory: ISynthesisConnectionFactory, synthesizerConfig: SynthesizerConfig, audioDestination: IAudioDestination);
isDisposed(): boolean;
dispose(reason?: string): Promise<void>;
connect(): Promise<void>;
sendNetworkMessage(path: string, payload: string | ArrayBuffer): Promise<void>;
Speak(text: string, isSSML: boolean, requestId: string, successCallback: (e: SpeechSynthesisResult) => void, errorCallBack: (e: string) => void, audioDestination: IAudioDestination): Promise<void>;
stopSpeaking(): Promise<void>;
protected cancelSynthesis(requestId: string, _cancellationReason: CancellationReason, errorCode: CancellationErrorCode, error: string): void;
protected cancelSynthesisLocal(cancellationReason: CancellationReason, errorCode: CancellationErrorCode, error: string): void;
protected processTypeSpecificMessages(_connectionMessage: SpeechConnectionMessage): boolean;
protected receiveMessage(): Promise<void>;
protected sendSynthesisContext(connection: IConnection): Promise<void>;
protected abstract setSynthesisContextSynthesisSection(): void;
protected setSpeechConfigSynthesisSection(): void;
protected connectImpl(isUnAuthorized?: boolean): Promise<IConnection>;
protected sendSpeechServiceConfig(connection: IConnection, SpeechServiceConfigJson: string): Promise<void>;
protected sendSsmlMessage(connection: IConnection, ssml: string, requestId: string): Promise<void>;
private fetchConnection;
private configureConnection;
protected onAvatarEvent(_metadata: ISynthesisMetadata): void;
protected onSynthesisStarted(_requestId: string): void;
protected onSynthesizing(_audio: ArrayBuffer): void;
protected onSynthesisCancelled(_result: SpeechSynthesisResult): void;
protected onSynthesisCompleted(_result: SpeechSynthesisResult): void;
protected onWordBoundary(_wordBoundaryEventArgs: SpeechSynthesisWordBoundaryEventArgs): void;
protected onVisemeReceived(_visemeEventArgs: SpeechSynthesisVisemeEventArgs): void;
protected onBookmarkReached(_bookmarkEventArgs: SpeechSynthesisBookmarkEventArgs): void;
}