Skip to content

EditorSounds beta ​

Class of @v12-engine/editor

ts
export declare class EditorSounds

How the game's sounds are played (campaign plan EQ9), as its sounds.json says (SOUNDS_FILE, SoundDef): each sound's volume, how much higher or lower each time, its reach and cutoff, its bus. Read from the game's files, laid at once over the view here and in a game played here, written as a step of the history (a change until the map is saved, Ctrl+S); played as it says. What the Sounds panel does, in code

A part of the editor, as it gives it (editor.sounds)

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the EditorSounds class.

Members ​

def ​

ts
def(name: string): SoundDef;

What the game's sounds.json says of a sound: nothing said for one it does not have

defs ​

ts
defs(): Record<string, SoundDef>;

How every sound is played as the game's view says with its sounds.json over it: what a game played here hears

error ​

ts
error(): string | undefined;

What is wrong with the game's sounds.json, where it could not be read: none when it reads

file ​

ts
file(): SoundsFile;

The game's sounds.json as the editor has it: as read or last written, else as the view laid it; empty for none

load ​

ts
load(text?: string): Promise<SoundsFile>;

Reads the game's sounds.json from its files (again, after it changed on disk: text, as files.watch tells it) and lays it over the view at once. A file that does not read is left as it was, and what is wrong kept (error)

names ​

ts
names(): string[];

Every sound there is to define, by name: the game's folder's, the shared ones and the map's (the Assets index's). Known once assets.ready

play ​

ts
play(name: string, def?: SoundDef): boolean;

Plays a sound as the file says it (or as def says, before it is written), at once and not from a place of the map: on the map's sounds while they are heard, else on a player of its own. Whether there was a file of it to play

set ​

ts
set(name: string, change: SoundDef | null, merge?: string): Promise<void>;

Sets how a sound is played, as a step of the history: its fields over what the file says (undefined takes a field out, and a sound with nothing left is out of the file), or null for nothing said of it. Changes with the same merge key one after another (a slider dragged) are one step. Settles once the file is read and written