Audio · interface

SoundSource

Explained in Your first game.

interface SoundSource
import type { SoundSource } from '@driftengine/audio';

Properties

NameTypeDescription
urlsreadonly string[]Candidate locations, tried in order; the first that loads wins.
More

A list rather than one path so a slot can accept whatever format the sound actually arrives in. Asking a composer to transcode before they can hear their track in the game is friction with nothing on the other side of it — the browser decodes all of these natively.

synthoptional(ctx: BaseAudioContext) => AudioBufferBuilt only when no candidate is present or usable.
More

Omitted, the slot is required. A stand-in is right for a footstep and wrong for a score that has to be the file or nothing a game would ship, which until now could not be registered at all and was decoded outside the registry. A required slot none of whose candidates loads is recorded in unbuilt, and load rejects — after every other slot has settled, so one absent file still silences nothing else — naming each such slot and what it tried.