Skip to content

bodhi-realtime-agent / AudioBuffer

Class: AudioBuffer ​

Defined in: src/transport/audio-buffer.ts:11

Bounded ring buffer for PCM audio chunks. When the buffer exceeds its capacity, the oldest chunks are dropped first. Used by ClientTransport to buffer audio during agent transfers and reconnections.

Constructors ​

Constructor ​

new AudioBuffer(maxDurationMs?): AudioBuffer

Defined in: src/transport/audio-buffer.ts:16

Parameters ​

maxDurationMs? ​

number = DEFAULT_MAX_DURATION_MS

Returns ​

AudioBuffer

Accessors ​

isEmpty ​

Get Signature ​

get isEmpty(): boolean

Defined in: src/transport/audio-buffer.ts:51

Returns ​

boolean


size ​

Get Signature ​

get size(): number

Defined in: src/transport/audio-buffer.ts:47

Returns ​

number

Methods ​

clear() ​

clear(): void

Defined in: src/transport/audio-buffer.ts:42

Returns ​

void


drain() ​

drain(): Buffer<ArrayBufferLike>[]

Defined in: src/transport/audio-buffer.ts:35

Remove and return all buffered chunks, resetting the buffer to empty.

Returns ​

Buffer<ArrayBufferLike>[]


push() ​

push(chunk): void

Defined in: src/transport/audio-buffer.ts:21

Add an audio chunk, dropping oldest chunks if the buffer is full.

Parameters ​

chunk ​

Buffer

Returns ​

void

Built with VitePress