/** * A handle on a session's outgoing audio that lets you push raw PCM audio, * interrupt the agent, check whether it is speaking, and observe when the last * audio byte has played. Constructed against a session, to whose events it * subscribes. * * Note: {@link AudioTrack.pause}, {@link AudioTrack.resume}, and * {@link AudioTrack.markSynthesisComplete} have no runtime effect in this SDK and * are kept for API compatibility. */ /** * Callback invoked when the last audio byte of a response has played. * @param durationSeconds Duration in seconds of the audio that just finished. */ export type LastAudioByteCallback = (durationSeconds: number) => void | Promise; /** See the module-level description for usage. */ export declare class AudioTrack { protected _session: any; protected _sampleRate: number; protected _lastAudioByteCallback: LastAudioByteCallback | null; /** * @param session The session this track sends audio to and listens on. * @param sampleRate Sample rate of pushed PCM audio, in Hz. Default: `48000`. */ constructor(session: any, sampleRate?: number); /** Sample rate of pushed PCM audio, in Hz. */ get sampleRate(): number; /** Whether the agent is currently speaking. */ get isSpeaking(): boolean; /** Whether the active TTS provider supports pausing playback. */ get canPause(): boolean; /** * Push a chunk of raw PCM audio to the session's outgoing audio. * @param pcm Raw PCM samples. * @param sampleRate Sample rate of `pcm` in Hz; defaults to {@link sampleRate}. */ addNewBytes(pcm: Uint8Array, sampleRate?: number | null): Promise; /** Interrupt the agent, cancelling any in-progress generation. */ interrupt(): Promise; /** No-op in this SDK; retained for API compatibility. */ pause(): Promise; /** No-op in this SDK; retained for API compatibility. */ resume(): Promise; /** No-op in this SDK; retained for API compatibility. */ markSynthesisComplete(): void; /** Register a callback fired when the last audio byte of a response has played. */ onLastAudioByte(callback: LastAudioByteCallback): void; protected _onLastAudioByte(payload: Record): void; }