Working on adding a Howler sound wrapper to the Editor to have better in-built sound capabilities:
Here is the API…
WickSound = class {
constructor(assetName) {
loop(loop)
volume(volume)
stereo(pan)
seek(seconds)
play(offset)
mute()
unmute()
isPlaying()
stop()
pause()
currently()
duration()
}
Example Usage:
// declaring an instance...
let mysong = new WickSound("mySong.mp3");
// play song starting at 3.5 seconds of the song...
mysong.play(3.5);
// set song to fully sound at left speaker
mysong.stereo(-1);
// pausing only this song
mysong.pause();
// resuming song where it was paused.
mysong.play();
// stop only this song
mysong.stop();
// set song to loop forever
mysong.loop(true);
// set song to not loop
mysong.loop(false);
// returns song duration in seconds...
mysong.duration()
// returns song current cursor in seconds...
mysong.currently()
// returns true if the song is still playing
mysong.isPlaying()
// set song volume to half of its max volume.
mysong.volume(0.5)
// mute song
mysong.mute()
// unmute song with the same volume before mute
mysong.unmute()
// seek (set song cursor to 34.6 seconds)
mysong.seek(34.6)
I’ll probably do a demo tomorrow… everything works already : )