ridder
Version:
A straightforward game engine for simple data-driven games in JavaScript
28 lines (27 loc) • 835 B
TypeScript
/**
* Load a sound into the cache.
* @param id - The ID for the sound in the cache.
* @param url - The url to the `.mp3`, `.wav`, or `.ogg` file.
* @param stream - Whether or not the sound should be streamed, e.g. for large files such as music.
*/
export declare function loadSound(id: number, url: string, stream?: boolean): Promise<void>;
/**
* Play a sound from the cache.
*/
export declare function playSound(id: number, loop?: boolean): void;
/**
* Stop a currently playing sound.
*/
export declare function stopSound(id: number): void;
/**
* Get a sound from the cache.
*/
export declare function getSound(id: number): HTMLAudioElement;
/**
* Set the global audio volume.
*/
export declare function setVolume(value: number): void;
/**
* Get the global audio volume.
*/
export declare function getVolume(): number;