From 9d70303ad54723c888c851681af52c5a42793654 Mon Sep 17 00:00:00 2001 From: "T.K. Broderick" Date: Sun, 15 Jun 2014 19:08:32 -0400 Subject: [PATCH 1/2] jshint and jsdoc --- Tone/component/DryWet.js | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/Tone/component/DryWet.js b/Tone/component/DryWet.js index 30692b80..4a4b7225 100644 --- a/Tone/component/DryWet.js +++ b/Tone/component/DryWet.js @@ -1,15 +1,15 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// DRY/WET KNOB -// -// equal power fading -// control values: -// 0 = 100% dry -// 1 = 100% wet -/////////////////////////////////////////////////////////////////////////////// - define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Scale"], function(Tone){ + /** + * DRY/WET KNOB + * + * equal power fading control values: + * 0 = 100% dry + * 1 = 100% wet + * + * @constructor + * @param {number} initialDry + */ Tone.DryWet = function(initialDry){ Tone.call(this); @@ -33,20 +33,30 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Scale"], function(T this.dry.gain.value = 0; this.wet.gain.value = 0; this.setDry(0); - } + }; Tone.extend(Tone.DryWet); - // @param {number} val - // @param {Tone.Time} rampTime + /** + * Set the dry value of the knob + * + * @param {number} val + * @param {Tone.Time} rampTime + */ Tone.DryWet.prototype.setDry = function(val, rampTime){ rampTime = this.defaultArg(rampTime, 0); this.control.linearRampToValueAtTime(val*2 - 1, this.toSeconds(rampTime)); - } + }; + /** + * Set the wet value of the knob + * + * @param {number} val + * @param {Tone.Time} rampTime + */ Tone.DryWet.prototype.setWet = function(val, rampTime){ this.setDry(1-val, rampTime); - } + }; return Tone.DryWet; }); From 61fa477aa0a216af995570bdbf878f1c4641fad0 Mon Sep 17 00:00:00 2001 From: "T.K. Broderick" Date: Sun, 15 Jun 2014 19:35:00 -0400 Subject: [PATCH 2/2] jshint and jsdoc --- Tone/component/Envelope.js | 45 ++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/Tone/component/Envelope.js b/Tone/component/Envelope.js index ad9bc07e..bc839d02 100644 --- a/Tone/component/Envelope.js +++ b/Tone/component/Envelope.js @@ -7,7 +7,16 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ - + /** + * Envelope + * ADR envelope generator attaches to an AudioParam + * @param {Tone.Time=} attack + * @param {Tone.Time=} decay + * @param {number=} sustain a percentage of the full amplitude + * @param {Tone.Time=} release + * @param {number=} minOutput + * @param {number=} maxOutput + */ Tone.Envelope = function(attack, decay, sustain, release, minOutput, maxOutput){ //extend Unit Tone.call(this); @@ -30,8 +39,10 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ Tone.extend(Tone.Envelope); - //attack->decay->sustain - //@param {Tone.Time} time + /** + * attack->decay->sustain linear ramp + * @param {Tone.Time} time + */ Tone.Envelope.prototype.triggerAttack = function(time){ var startVal = this.min; if (!time){ @@ -48,7 +59,10 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ this.control.linearRampToValueAtTime(sustainVal, time + attackTime + decayTime); }; - //attack->decay->sustain + /** + * attack->decay->sustain exponential ramp + * @param {Tone.Time} time + */ Tone.Envelope.prototype.triggerAttackExp = function(time){ var startVal = this.min; if (!time){ @@ -64,7 +78,11 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ this.control.exponentialRampToValueAtTime(sustainVal, time + attackTime + decayTime); }; - //triggers the release of the envelope + + /** + * triggers the release of the envelope with a linear ramp + * @param {Tone.Time} time + */ Tone.Envelope.prototype.triggerRelease = function(time){ var startVal = this.control.getValue(); if (time){ @@ -78,7 +96,10 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ }; - //triggers the release of the envelope + /** + * triggers the release of the envelope with an exponential ramp + * @param {Tone.Time} time + */ Tone.Envelope.prototype.triggerReleaseExp = function(time){ var startVal = this.control.getValue(); if (time){ @@ -91,11 +112,17 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ this.control.exponentialRampToValueAtTime(this.min, time + this.toSeconds(this.release)); }; - //@private - //pointer to the parent's connect method + /** + * @private + * pointer to the parent's connect method + * @type {[type]} + */ Tone.Envelope.prototype._connect = Tone.prototype.connect; - //triggers the release of the envelope + /** + * triggers the release of the envelope + * @param {number} param + */ Tone.Envelope.prototype.connect = function(param){ if (param instanceof AudioParam){ //set the initial value