Skip to content

probe-web / @probe-web/ui / SampleDecoder

Class: SampleDecoder ​

Defined in: packages/ui/src/samples.ts:38

Decodes a stream of samples, carrying an incomplete tail between calls.

One decoder per channel: they each have their own leftover bytes.

Constructors ​

Constructor ​

ts
new SampleDecoder(format?): SampleDecoder;

Defined in: packages/ui/src/samples.ts:43

Start a decoder for format samples with no leftover bytes.

Parameters ​

ParameterTypeDefault value
formatSampleFormat'u32'

Returns ​

SampleDecoder

Accessors ​

format ​

Get Signature ​

ts
get format(): SampleFormat;

Defined in: packages/ui/src/samples.ts:51

The sample format being decoded. Changing the format drops any partial sample, which belonged to the old one.

Returns ​

SampleFormat

Set Signature ​

ts
set format(format): void;

Defined in: packages/ui/src/samples.ts:55

Parameters ​
ParameterType
formatSampleFormat
Returns ​

void

Methods ​

reset() ​

ts
reset(): void;

Defined in: packages/ui/src/samples.ts:62

Forget any partial sample, e.g. after a reset.

Returns ​

void


push() ​

ts
push(bytes): number[];

Defined in: packages/ui/src/samples.ts:70

Decode whatever whole samples these bytes complete, together with any leftover from the previous call. A trailing partial sample is kept for the next call.

Parameters ​

ParameterType
bytesUint8Array<ArrayBufferLike> | number[]

Returns ​

number[]