From 420188253e781d5b14240e947510cc527df7fde7 Mon Sep 17 00:00:00 2001 From: Divyanshu Raj Date: Sat, 2 May 2020 20:53:55 +0530 Subject: [PATCH] added checks to avoid multiple start calls --- src/signal.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/signal.js b/src/signal.js index 6391089f..14c289c9 100644 --- a/src/signal.js +++ b/src/signal.js @@ -30,7 +30,7 @@ define(function (require) { * @return {Tone.Signal} A Signal object from the Tone.js library * @example *
- * let carrier, modulator; + * let carrier, modulator,hasStarted = false; * * function setup() { * let cnv = createCanvas(100, 100); @@ -57,10 +57,14 @@ define(function (require) { * function canvasPressed() { * userStartAudio(); * carrier.amp(1.0); - * carrier.start(); + * if(!hasStarted){ + * carrier.start(); + * hasStarted!=hasStarted; + * } * } * * function mouseReleased() { + * hasStarted = false; * carrier.amp(0); * } *