UNPKG

@voice-ping/cognitive-services-speech

Version:

VoicePing Cognitive Services Speech SDK for JavaScript forked from Microsoft

62 lines (61 loc) 4.05 kB
import { ConnectionEvent, EventSource, IAudioDestination, IConnection, IDisposable, Promise, ServiceEvent } from "../common/Exports"; import { AudioOutputFormatImpl } from "../sdk/Audio/AudioOutputFormat"; import { CancellationErrorCode, CancellationReason, SpeechSynthesisResult, SpeechSynthesizer } from "../sdk/Exports"; import { Callback } from "../sdk/Transcription/IConversation"; import { AgentConfig, ISynthesisConnectionFactory, SynthesisContext, SynthesisTurn, SynthesizerConfig } from "./Exports"; import { IAuthentication } from "./IAuthentication"; import { SpeechConnectionMessage } from "./SpeechConnectionMessage.Internal"; export declare class SynthesisAdapterBase implements IDisposable { protected privSynthesisTurn: SynthesisTurn; protected privConnectionId: string; protected privSynthesizerConfig: SynthesizerConfig; protected privSpeechSynthesizer: SpeechSynthesizer; 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) => any; static telemetryData: (json: string) => void; static telemetryDataEnabled: boolean; set activityTemplate(messagePayload: string); get activityTemplate(): string; protected receiveMessageOverride: () => any; protected connectImplOverride: (isUnAuthorized: boolean) => any; protected configConnectionOverride: () => any; protected fetchConnectionOverride: () => any; set audioOutputFormat(format: AudioOutputFormatImpl); private privAuthentication; private privConnectionFactory; private privConnectionConfigurationPromise; private privConnectionPromise; private privAuthFetchEventId; private privIsDisposed; private privConnectionEvents; private privServiceEvents; private privSynthesisContext; private privAgentConfig; private privServiceHasSentMessage; private privActivityTemplate; private privAudioOutputFormat; private privSessionAudioDestination; constructor(authentication: IAuthentication, connectionFactory: ISynthesisConnectionFactory, synthesizerConfig: SynthesizerConfig, speechSynthesizer: SpeechSynthesizer, audioDestination: IAudioDestination); static addHeader(audio: ArrayBuffer, format: AudioOutputFormatImpl): ArrayBuffer; isDisposed(): boolean; dispose(reason?: string): void; connect(): void; connectAsync(cb?: Callback, err?: Callback): void; sendNetworkMessage(path: string, payload: string | ArrayBuffer, success?: () => void, err?: (error: string) => void): void; Speak(text: string, isSSML: boolean, requestId: string, successCallback: (e: SpeechSynthesisResult) => void, errorCallBack: (e: string) => void, audioDestination: IAudioDestination): Promise<boolean>; protected cancelSynthesis(requestId: string, cancellationReason: CancellationReason, errorCode: CancellationErrorCode, error: string): void; protected cancelSynthesisLocal(cancellationReason: CancellationReason, errorCode: CancellationErrorCode, error: string): void; protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage, successCallback?: (e: SpeechSynthesisResult) => void, errorCallBack?: (e: string) => void): boolean; protected receiveMessage: () => Promise<IConnection>; protected sendSynthesisContext: (connection: IConnection) => Promise<boolean>; protected connectImpl(isUnAuthorized?: boolean): Promise<IConnection>; protected sendSpeechServiceConfig: (connection: IConnection, SpeechServiceConfigJson: string) => Promise<boolean>; protected sendSsmlMessage: (connection: IConnection, ssml: string, requestId: string) => Promise<boolean>; private fetchConnection; private configureConnection; }