Skip to content

Commit

Permalink
added checks to avoid multiple start calls
Browse files Browse the repository at this point in the history
  • Loading branch information
endurance21 committed May 2, 2020
1 parent a5d6573 commit dab7fd7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ define(function (require) {
* @return {Tone.Signal} A Signal object from the Tone.js library
* @example
* <div><code>
* let carrier, modulator;
* let carrier, modulator,hasStarted = false;
*
* function setup() {
* let cnv = createCanvas(100, 100);
Expand All @@ -57,11 +57,15 @@ define(function (require) {
* function canvasPressed() {
* userStartAudio();
* carrier.amp(1.0);
* carrier.start();
* if(!hasStarted){
* carrier.start();
* hasStarted!=hasStarted;
* }
* }
*
* function mouseReleased() {
* carrier.amp(0);
* hasStarted = false;
* carrier.amp(0);
* }
* </code></div>
*/
Expand Down

0 comments on commit dab7fd7

Please sign in to comment.