Skip to content

@liminal-hq/undertone / getSampleBuffer

Function: getSampleBuffer()

getSampleBuffer(ctx, name, bank?): AudioBufferLike | undefined

Defined in: samples.ts:173

The engine-facing, synchronous lookup: returns the decoded buffer if it's ready, otherwise kicks off (or joins an in-flight) decode and returns undefined for this call — the voice is skipped this time, and later onsets of the same sample will find it once decoding finishes. Warns once per key, only for a genuinely unregistered name or a decode that ultimately fails — a registered sample that just hasn't finished decoding yet is not a warning, that's what loadSamples() is for.

Parameters

ctx

AudioContextLike

name

string

bank?

string

Returns

AudioBufferLike | undefined