Audio · class
MixConsole
Explained in Your first game.
class MixConsoleimport { MixConsole } from '@driftengine/audio';Constructor
new
constructor(context: BaseAudioContext, options?: MixConsoleOptions)| Parameter | Type | Description |
|---|---|---|
context | BaseAudioContext | |
options? | MixConsoleOptions |
Properties
| Name | Type | Description |
|---|---|---|
contextreadonly | BaseAudioContext | |
masterreadonly | MixBus | Everything ends up here. Its insert chain is where a master filter belongs. |
outreadonly | GainNode | What reaches the speakers, summed in one place.MoreThe same node, for the same reason, as the |
Accessors
| Name | Type | Description |
|---|---|---|
allget | readonly MixBus[] |
Methods
bus
bus(name: string, options?: BusOptions): MixBusThe bus called name, created under master if it does not exist yet.
| Parameter | Type | Description |
|---|---|---|
name | string | |
options? | BusOptions |
More
One verb rather than a create and a get, because a caller declaring a bus at startup and a caller reaching for one by name are asking the same question, and two verbs would mean choosing between them on every line. Cost: a typo makes a bus instead of an error. What would make this wrong is a console large enough to lose one in, which is when a caller should be holding the reference rather than the name.
find
find(name: string): MixBus | undefined| Parameter | Type | Description |
|---|---|---|
name | string |
at
at(seconds: number | null): voidSchedule everything that follows at seconds on this context's timeline, or at "now" when null.
| Parameter | Type | Description |
|---|---|---|
seconds | number | null |
More
An offline render sets it once per frame and gets a mix whose every move lands exactly where the picture is. Live callers never touch it.
Has no effect when a scheduleAt was supplied, because then somebody else owns the answer
and this console is a reader of it. That is the case whenever an AudioGraph built the
console: the transport's own at() is the one to call.
scheduleAt
scheduleAt(): numberThe instant scheduled work lands on. One reader, so "when" has one answer in a mix.
random
random(): numbersnapshot
snapshot(name: string): MixSnapshotCapture every level, mute and send, under a name.
| Parameter | Type | Description |
|---|---|---|
name | string |
recall
recall(name: string, seconds?: number): booleanCrossfade back to a captured snapshot over seconds. False, and nothing moves, when no
snapshot was taken under that name.
| Parameter | Type | Description |
|---|---|---|
name | string | |
seconds? | number |