@fuwu-yuan/bgew
Version:
Baguette Game Engine Web is a french 2D Web game engine
56 lines (55 loc) • 1.8 kB
TypeScript
import { Howl } from "howler";
export declare class Sound {
private _howl;
/**
*
* @param name Sound name
* @param src One or more src (same sound with multiple src formats)
* @param repeat Ether to repeat of not the sound at the end
* @param volume Volume to play sound by default (default 0.5)
* @param sprites Object defining sprites in this sound (optional)
*/
constructor(name: string, src: string | string[], repeat?: boolean, volume?: number, sprites?: {
[key: string]: [number, number];
});
/**
* Play the sound
*
* @param repeat Ether to repeat the sound at the end
* @param volume Optional volume (default 0.5)
* @param sprite Optional sprite name if your sound is divided by sprites
* @return id The sound id. Can be used to stop sound
*/
play(repeat?: boolean, volume?: number, sprite?: string): number;
/**
* Stop the current sound
*
* @param fadeout Ether to fadeout the sound before stopping it
* @param fadeDuration The fade duration if fadeout
* @param id Optional id of the sound
*/
stop(fadeout?: boolean, fadeDuration?: number, id?: number): void;
/**
* Mute/Unmute the sound
*
* @param mute True to mute, False to unmute
* @param id Optional sound id
*/
mute(mute?: boolean, id?: number): void;
/**
* Change sound volume
*
* @param volume New volume
* @param id Optional sound id
*/
volume(volume: number, id?: number): void;
/**
* Loop the sound
*
* @param repeat Ether to repeat or not the sound at the end
* @param id Optional sound id
*/
repeat(repeat?: boolean, id?: number): void;
get howl(): Howl;
set howl(value: Howl);
}