PlayedSound beta
Class of @v12-engine/client
export declare class PlayedSound implements CutSoundA sound played with a handle: see the top of this file. Made by the player (SoundPlayer.sound), which hands it its file
Members
constructor
constructor(
context: BaseAudioContext,
name: string,
bus: Bus, destination: AudioNode, shape: SoundShape & {
pan?: number;
}, told: Told,
heard?: Heard,
mode?: HearingMode);Constructs a new instance of the PlayedSound class
at
at(spot: Vec2): void;Puts it where spot is on the map: as loud and to the side as a sound of the game's there, silent beyond what is heard
buffer
buffer: AudioBuffer | undefined;The file's buffer, once it is loaded; undefined before
bus
readonly bus: Bus;The bus the sound plays through
context
readonly context: BaseAudioContext;The Web Audio context the sound is made in
currentTime
get currentTime(): number;Seconds into the file it is now, wrapped to the file's length for a loop
duration
get duration(): number;Seconds the file lasts at rate 1; 0 until it is loaded
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;Sets its fade, over its volume, to level (not below 0), eased over seconds along ease; ignored once it is stopping
gain
readonly gain: GainNode;Its volume's node, set by volume
highpass
highpass(hz: number, seconds?: number): void;Cuts frequencies below hz, glided over seconds
input
readonly input: GainNode;Where the sound enters its chain: the source plays into it
insert
insert(input: AudioNode, output?: AudioNode): () => void;Puts the nodes input to output (the same node when left out) in its chain, and gives back a function that takes them out
lowpass
lowpass(hz: number, seconds?: number): void;Cuts frequencies above hz, glided over seconds
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's node, set by pan: what goes on to the bus
pan
pan(pan: number, seconds?: number): void;Sets its side to pan (clamped to -1..1), glided over seconds
pause
pause(): void;Pauses it where it is, or while its file loads; no effect once it is stopping or over
playing
get playing(): boolean;Whether it is playing now: begun, and not paused, stopped or over
rate
rate(rate: number, seconds?: number): void;Sets how fast it plays to rate (above 0), the position kept, glided over seconds
resume
resume(): void;Plays it on from where it was paused
seek
seek(seconds: number): void;Moves its playing position to seconds into the file (not below 0), playing on if it was playing
source
source: AudioBufferSourceNode | undefined;The source playing now: a new one each time it is played on or seeked, none while paused or over
started
readonly started: Promise<boolean>;Settles with true once it begun, or false once it is known it never will
stop
stop(fade?: number): void;Stops it, faded out over fade seconds (at once when 0)
volume
volume(level: number, seconds?: number, ease?: (k: number) => number): void;Sets its volume to level (not below 0), eased over seconds along ease