Skip to main content

Abstract Class: AudioDevice

Defined in: platform/audio-device.ts:12

Stackable audio player driven by the AssetManager.

The AssetManager decides which audio data is needed within the current look-ahead window and pushes it in via append; the device caches the decoded form, schedules the matching AudioRequests via schedule, and drives playback through syncTo on each tick.

Constructors

Constructor

new AudioDevice(): AudioDevice

Returns

AudioDevice

Methods

append()

abstract append(src, data): Promise<void>

Defined in: platform/audio-device.ts:20

Decode and stack data under src. Idempotent — repeat calls for an already-cached src are no-ops.

Parameters

src

string

data

ArrayBuffer

Returns

Promise<void>


dispose()

dispose(): void

Defined in: platform/audio-device.ts:47

Returns

void


has()

abstract has(src): boolean

Defined in: platform/audio-device.ts:14

True if decoded data for src is already cached on the device.

Parameters

src

string

Returns

boolean


play()

abstract play(time, speed, reverse): void | Promise<void>

Defined in: platform/audio-device.ts:38

Parameters

time

number

speed

number

reverse

boolean

Returns

void | Promise<void>


retain()

abstract retain(keep): void

Defined in: platform/audio-device.ts:23

Drop cached audio data (and any active sources) for srcs not in keep.

Parameters

keep

ReadonlySet<string>

Returns

void


schedule()

abstract schedule(requests): void

Defined in: platform/audio-device.ts:30

Set the working set of audio requests for the current look-ahead window. Requests no longer present are stopped; new ones become eligible for playback via syncTo as soon as their data is appended.

Parameters

requests

readonly AudioRequest[]

Returns

void


setMuted()

setMuted(_muted): void

Defined in: platform/audio-device.ts:45

Mute or unmute all output. Default is a no-op for devices that produce no sound (e.g. export/noop sinks).

Parameters

_muted

boolean

Returns

void


stop()

abstract stop(): void

Defined in: platform/audio-device.ts:39

Returns

void


syncTo()

abstract syncTo(sceneTime): void

Defined in: platform/audio-device.ts:36

Start/stop scheduled sources to match sceneTime. Called every tick. Sources whose data has not yet been appended are skipped until it is.

Parameters

sceneTime

number

Returns

void