File tree Expand file tree Collapse file tree 4 files changed +25
-11
lines changed
Expand file tree Collapse file tree 4 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ define(function (require) {
1919 *
2020 * function preload(){
2121 * soundFormats('ogg', 'mp3');
22- * sound1 = loadSound('../_files /Damscray_-_Dancing_Tiger_01');
23- * sound2 = loadSound('../_files /beat.mp3');
22+ * sound1 = loadSound('assets /Damscray_-_Dancing_Tiger_01');
23+ * sound2 = loadSound('assets /beat.mp3');
2424 * }
2525 *
2626 * function setup() {
Original file line number Diff line number Diff line change @@ -48,18 +48,19 @@ define(function () {
4848 * var cnv, soundFile, fft, peakDetect;
4949 * var ellipseWidth = 10;
5050 *
51+ * function preload() {
52+ * soundFile = loadSound('assets/beat.mp3');
53+ * }
54+ *
5155 * function setup() {
5256 * background(0);
5357 * noStroke();
5458 * fill(255);
5559 * textAlign(CENTER);
5660 *
57- * soundFile = loadSound('assets/beat.mp3');
58- *
5961 * // p5.PeakDetect requires a p5.FFT
6062 * fft = new p5.FFT();
6163 * peakDetect = new p5.PeakDetect();
62- *
6364 * }
6465 *
6566 * function draw() {
@@ -179,11 +180,14 @@ define(function () {
179180 * var cnv, soundFile, fft, peakDetect;
180181 * var ellipseWidth = 0;
181182 *
183+ * function preload() {
184+ * soundFile = loadSound('assets/beat.mp3');
185+ * }
186+ *
182187 * function setup() {
183188 * cnv = createCanvas(100,100);
184189 * textAlign(CENTER);
185190 *
186- * soundFile = loadSound('assets/beat.mp3');
187191 * fft = new p5.FFT();
188192 * peakDetect = new p5.PeakDetect();
189193 *
Original file line number Diff line number Diff line change @@ -316,7 +316,13 @@ define(function (require) {
316316 if ( window . location . origin . indexOf ( 'file://' ) > - 1 && window . cordova === 'undefined' ) {
317317 alert ( 'This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS' ) ;
318318 }
319- var cReverb = new p5 . Convolver ( path , callback , errorCallback ) ;
319+ var self = this ;
320+ var cReverb = new p5 . Convolver ( path , function ( buffer ) {
321+ if ( typeof callback === 'function' ) {
322+ callback ( buffer ) ;
323+ }
324+ self . _decrementPreload ( ) ;
325+ } , errorCallback ) ;
320326 cReverb . impulses = [ ] ;
321327 return cReverb ;
322328 } ;
Original file line number Diff line number Diff line change @@ -451,7 +451,8 @@ define(function (require) {
451451 * @param {String } str 'restart' or 'sustain' or 'untilDone'
452452 * @example
453453 * <div><code>
454- * function setup(){
454+ * var mySound;
455+ * function preload(){
455456 * mySound = loadSound('assets/Damscray_DancingTiger.mp3');
456457 * }
457458 * function mouseClicked() {
@@ -734,7 +735,7 @@ define(function (require) {
734735 * var ball = {};
735736 * var soundFile;
736737 *
737- * function setup () {
738+ * function preload () {
738739 * soundFormats('ogg', 'mp3');
739740 * soundFile = loadSound('assets/beatbox.mp3');
740741 * }
@@ -1521,15 +1522,18 @@ define(function (require) {
15211522 * useful for removeCue(id)
15221523 * @example
15231524 * <div><code>
1525+ * var mySound;
1526+ * function preload() {
1527+ * mySound = loadSound('assets/beat.mp3');
1528+ * }
1529+ *
15241530 * function setup() {
15251531 * background(0);
15261532 * noStroke();
15271533 * fill(255);
15281534 * textAlign(CENTER);
15291535 * text('click to play', width/2, height/2);
15301536 *
1531- * mySound = loadSound('assets/beat.mp3');
1532- *
15331537 * // schedule calls to changeText
15341538 * mySound.addCue(0.50, changeText, "hello" );
15351539 * mySound.addCue(1.00, changeText, "p5" );
You can’t perform that action at this time.
0 commit comments