Open SableRaf opened 2 weeks ago
The loadSound() function's callbacks (success, error, and whileLoading) aren't being triggered as expected in the p5.sound prerelease. This prevents handling events during the loading process and confirming a successful or failed load.
loadSound()
loadSound(path, [successCallback], [errorCallback], [whileLoading])
let player; function preload() { player = loadSound( 'https://tonejs.github.io/audio/berklee/gong_1.mp3', () => { console.log("success"); }, // Success callback () => { console.log("failure"); }, // Error callback (progress) => { console.log(`Loading: ${progress * 100}%`); } // While loading callback ); } function setup() { createCanvas(100, 100); background(220); } function mousePressed() { player.play(); }
@tmartinez88 this._decrementPreload() needs to be manually called when loading completes for preload() to work with loadSound(). See docs here
this._decrementPreload()
preload()
The
loadSound()
function's callbacks (success, error, and whileLoading) aren't being triggered as expected in the p5.sound prerelease. This prevents handling events during the loading process and confirming a successful or failed load.Function Signature
loadSound(path, [successCallback], [errorCallback], [whileLoading])
Example
Expected Behavior
Actual Behavior