@euirim/microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
35 lines (34 loc) • 869 B
TypeScript
import { AudioStreamFormat } from "../Exports";
/**
* Base audio player class
* TODO: Plays only PCM for now.
* @class
*/
export declare class BaseAudioPlayer {
private audioContext;
private gainNode;
private audioFormat;
private autoUpdateBufferTimer;
private samples;
private startTime;
/**
* Creates and initializes an instance of this class.
* @constructor
*/
constructor(audioFormat: AudioStreamFormat);
/**
* play Audio sample
* @param newAudioData audio data to be played.
*/
playAudioSample(newAudioData: ArrayBuffer): void;
/**
* stops audio and clears the buffers
*/
stopAudio(): void;
private init;
private ensureInitializedContext;
private createAudioContext;
private formatAudioData;
private formatArrayBuffer;
private updateAudioBuffer;
}