CutSound beta
Interface of @v12-engine/client
export interface CutSoundA sound as code holds it while it plays (CN50): cut.audio.sound(...), voice, stinger, and the audio lane's clips (RunningClip.handle). Stopped, faded, made louder, faster, to a side, muffled, over so many seconds; paused and played on, seeked; and every Web Audio node of it there to reach, with a way to put nodes of one's own in its chain (insert)
Members
at
at(spot: Vec2): void;Where on the map it is heard from now: as loud, and to the side, as a sound of the game's there (nothing beyond what is heard, until it comes near again). A sound on a unit (cut.audio.sound(name, { at: unit }), an audio clip's on) is put where it is every frame (CN52)
buffer
readonly buffer: AudioBuffer | undefined;The file's buffer, once it is there
bus
readonly bus: Bus;The bus the sound plays through, which sets its volume and mute
context
readonly context: BaseAudioContext;The Web Audio context the sound is made in
currentTime
readonly currentTime: number;Seconds into the file it is now
duration
readonly duration: number;Seconds the file lasts (at rate 1); 0 until it is there
ended
readonly ended: Promise<void>;Settles once it is over: played to its end, stopped, or never begun
fade
fade(level: number, seconds?: number, ease?: (k: number) => number): void;Its fade, over its volume (0 to 1): what a clip's in and out move, and a stop's fade
gain
readonly gain: GainNode;Its volume (volume)
highpass
highpass(hz: number, seconds?: number): void;Cuts frequencies below hz, glided over seconds (at once when left out)
input
readonly input: GainNode;Where the source plays into
insert
insert(input: AudioNode, output?: AudioNode): () => void;Puts nodes of one's own in its chain, after the filters and before its fades (one node, or a chain of them from input to output: the output is the sound's to connect, and disconnected as it is taken out). What it gives back takes them out again
lowpass
lowpass(hz: number, seconds?: number): void;The filters' cut, in Hz
name
readonly name: string;The sound's name, as it was asked for
nodes
readonly nodes: SoundNodes;The nodes of its chain, by what each does
output
readonly output: StereoPannerNode;Its side (pan): what goes to the bus
pan
pan(pan: number, seconds?: number): void;To which side, -1 to 1, over where it is heard from
pause
pause(): void;Pauses it where it is; resume plays it on
playing
readonly playing: boolean;Whether it is playing now: begun, and not paused, stopped or over
rate
rate(rate: number, seconds?: number): void;How fast it plays, and so how high
resume
resume(): void;Plays it on from where it was paused
seek
seek(seconds: number): void;Seconds into the file it plays from now
source
readonly source: AudioBufferSourceNode | undefined;The source playing now: a new one each time it is played on or seeked (through a gain of its own into input, that fades it in and out over a few milliseconds). None while paused or over
started
readonly started: Promise<boolean>;Settles once it began (true), or once it is known it never will (false: no file, too late, stopped first)
stop
stop(fade?: number): void;Stops it, faded out over fade seconds (at once when left out)
volume
volume(level: number, seconds?: number, ease?: (k: number) => number): void;Its volume, eased there over seconds along ease (straight when left out)