Skip to content

Commit

Permalink
Applying new loadXX _decrementPreload logic to loadSound
Browse files Browse the repository at this point in the history
  • Loading branch information
bomoko committed Jun 26, 2017
1 parent 38f614a commit ea9ef24
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/soundfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,15 @@ define(function (require) {
alert('This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS');
}

var s = new p5.SoundFile(path, callback, onerror, whileLoading);
var self = this;
var s = new p5.SoundFile(path, function() {
if(typeof callback === 'function') {
callback.apply(self, arguments);
}

self._decrementPreload();
}, onerror, whileLoading);

return s;
};

Expand Down

0 comments on commit ea9ef24

Please sign in to comment.