Skip to content

AppMixer beta ​

Class of @v12-engine/client

ts
export declare class AppMixer

The sound of a whole app: see the top of this file. Made once for an app (ClientRuntime.mixer), or by a SoundPlayer given none, for itself alone

const mixer = await app.runtime.mixer() mixer.bus('radio', label: 'Radio', level: 0.6, speaks: true ) mixer.snapshot('inside', buses: ambience: 0.3 , lowpass: 900 ) mixer.recall('inside', 0.5)

Members ​

constructor ​

ts
constructor(options?: MixerOptions & {
        storage?: KeptStorage;
    });

Constructs a new instance of the AppMixer class

bus ​

ts
bus(id: Bus, options?: BusOptions): MixerBus;

A bus: one of the client's, or a game's own, made as it is first named (BusOptions). Its volume is the player's like any other, kept for the next game, and in the HUD's mixer

configure ​

ts
configure(options?: MixerOptions): void;

What is declared of the mix (MixerOptions), over what was: what it does not say stays

context ​

ts
get context(): AudioContext;

The context, made as the first sound needs it: a browser complains of one made before a click

crossfade ​

ts
crossfade: number;

Seconds music takes to go over to other music, where nothing says (MixerOptions.crossfade)

dispose ​

ts
dispose(): void;

Stops the music and any fades, removes the unlock listeners and closes the audio context

duck ​

ts
duck(options: DuckOptions): void;

How far and how fast the buses that duck go down while someone speaks

hold ​

ts
hold(held: boolean): void;

Holds every sound, music too, where it is, or lets them go on: an editor's own while a game is played over it, whose keys and clicks would otherwise wake them

isMuted ​

ts
get isMuted(): boolean;

Whether the player has muted all sound

label ​

ts
label(id: Bus): string | undefined;

What a bus is called in the mixer: the words a game's own says, none for the client's five

leave ​

ts
leave(who: object, scaled: Iterable<Bus>): void;

What a scene set on the mix goes as it goes: its pause, its cinematic's scales, the snapshot it went to, its music

letGoMusic ​

ts
letGoMusic(owner: object, seconds?: number): void;

Music comes to an end with who it belongs to, faded over seconds, unless someone took it over: what a game's music does as nothing after it says otherwise. A menu's stays until a scene says

level ​

ts
level(bus: Bus | 'master'): number;

The volume of a bus, or of everything, 0..1

levels ​

ts
levels(): SoundLevels;

The volumes the player set, of everything and of each bus

listen ​

ts
listen(told: () => void): () => void;

Told each time the player's mix is set or a bus is added. Gives back what stops it

musicTracks ​

ts
get musicTracks(): string[];

The music playing now: its tracks, none for none

musicVolume ​

ts
musicVolume(level: number, seconds?: number): void;

The music's own volume (0 to 1), eased over seconds

node ​

ts
node(id: Bus): GainNode;

The Web Audio node of a bus, which what is heard on it goes into

onPause ​

ts
onPause(options: MixerPause): void;

What a pause does to the sound (MixerPause)

pause ​

ts
pause(on: boolean, who?: object): void;

The game paused or going on, for who (the sound is paused while anyone holds it): what onPause says then. The client says it itself, of its pause menu and a server's pause

paused ​

ts
get paused(): boolean;

Whether anyone holds the sound paused

playFile ​

ts
playFile(url: string, options?: {
        bus?: Bus;
        volume?: number;
    }): MixerFile;

A file heard through the mix, once, on a bus (a voice by default: the buses that duck go down while it lasts): what a screen of the app plays that is not a sound of a game's folder (a mission's briefing)

playingMusic ​

ts
playingMusic(): CutMusic | undefined;

The music playing now, as code reaches it (CutMusic): its element, its volume's node. None for none

recall ​

ts
recall(name?: string, seconds?: number, who?: object): void;

Goes to a state of the mix by its name over seconds, or back to the mix as the player set it with no name. who: as they go, the mix goes back with them (a game ended on the inside of a cave leaves no cave over the menu). A name there is none of says so

resume ​

ts
resume(): void;

Wakes the sound, as a click or a key has: what is started while the context wakes up plays once it has

scale ​

ts
scale(bus: Bus, level: number, seconds?: number): void;

A bus at level of the player's volume for it (1 as they set it), eased over seconds: a cinematic's say over the mix (D1)

setLevel ​

ts
setLevel(bus: Bus | 'master', level: number): void;

Sets the volume of a bus, or of everything. Remembered for the next game

setMusic ​

ts
setMusic(tracks: readonly string[], options?: MusicOptions): void;

Plays other music, or none: the tracks one after the other, over and over. Music already playing the same files goes on as it is, under its new owner: what carries from a menu into a mission

setMuted ​

ts
setMuted(muted: boolean): void;

Turns all sound off or on again. Remembered for the next game

snapshot ​

ts
snapshot(name: string, state?: MixerSnapshot): MixerSnapshot;

A state of the mix to go to by name (recall): as state says, or as the mix stands now, the player's own volumes apart. Gives back what it keeps

speak ​

ts
speak(started: boolean): void;

Someone started saying a line, or finished one: the buses that duck go down, or back

speaks ​

ts
speaks(id: Bus): boolean;

Whether what plays on this bus is someone speaking: the buses that duck go down for it

unlocked ​

ts
unlocked: boolean;

Whether the player has clicked or pressed a key yet. Until then nothing may play