Queues a sound to be loaded and ready for use in your update function.,Audio files are expected be .mp3
- filepath : string //location of the image file to be loaded
Queues a sound to be loaded and ready for use in your update function.,Audio files are expected be .mp3
- filepath : string //location of the image file to be loaded
const btn = $.makeButton($.w/2,$.h/2,100,50,"play");
const volumeControls = $.makeSlider($.w/2,200,100);
const example = $.loadSound("/sounds/sample.mp3");
function update() {
if(example.isPlaying) {
$.colour.fill="green";
}
$.shape.rectangle($.w/2,$.h/2,$.w,$.h);
/**
* if you click this, wait a second and click again
* you'll hear the audio play multiple times
* if you want it to only play one copy
* set .maxCopies for the sound to 1 :)
* */
if(btn.released) {
example.play();
example.volume=50;
}
example.volume=volumeControls.value;
btn.draw();
volumeControls.draw();
}