Audio · interface

MixConsoleOptions

The mixer: a tree of buses, and the one place that can answer a question about all of them.

Explained in Your first game.

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

In depth

A bus knows its own level and its own parent. Solo is the question no bus can answer alone — "is anything else soloed, and am I part of it" is a property of the whole tree — so the tree is held here and every bus asks this when its own solo changes.

Everything scheduled through one clock. at() and scheduleAt() are the same pair AudioGraph has always had, and for the same reason: offline there is no "now", so a render describes its whole timeline against instants a caller supplies. Every bus is handed this clock at construction, so there is exactly one answer to "when" in a mix rather than one per node.

Properties

NameTypeDescription
scheduleAtreadonlyoptionalScheduleClockWhere "now" is. Defaults to the context's own clock, which is what a live mix wants.
randomreadonlyoptional() => numberWhere randomness comes from, for anything this console builds that needs it — today, the noise an impulse response is made of.
More

Defaults to Math.random, and exists because a reverb built from an unseeded generator is a different reverb on every construction, so nothing carrying wet signal can be asserted exactly. The same rule AGENTS.md applies to storage and to clocks: take the capability as a parameter and ship the browser's as the default.

Cost: a caller that seeds this gets a reproducible reverb and also a worse-sounding one if they seed it badly, because the tail's quality is the quality of its noise. What would make this wrong is a consumer using it to make the reverb deterministic in production, which is solving a problem nobody has at the price of one they will.