envelope uses Signal instead of TimelineSignal

they are equivalent now bc of the AudioParam shim
This commit is contained in:
Yotam Mann 2017-10-26 00:51:31 -04:00
parent 374365f2a8
commit 2d2424e639

View file

@ -84,8 +84,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
* @type {Tone.TimelineSignal} * @type {Tone.TimelineSignal}
* @private * @private
*/ */
this._sig = this.output = new Tone.TimelineSignal(); this._sig = this.output = new Tone.Signal(0);
this._sig.setValueAtTime(0, 0);
//set the attackCurve initially //set the attackCurve initially
this.attackCurve = options.attackCurve; this.attackCurve = options.attackCurve;
@ -249,7 +248,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
} else if (this._attackCurve === "exponential"){ } else if (this._attackCurve === "exponential"){
this._sig.targetRampTo(velocity, attack, time); this._sig.targetRampTo(velocity, attack, time);
} else if (attack > 0){ } else if (attack > 0){
this._sig.setRampPoint(time); this._sig.cancelAndHoldAtTime(time);
var curve = this._attackCurve; var curve = this._attackCurve;
//take only a portion of the curve //take only a portion of the curve
if (attack < originalAttack){ if (attack < originalAttack){
@ -262,7 +261,9 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
this._sig.setValueCurveAtTime(curve, time, attack, velocity); this._sig.setValueCurveAtTime(curve, time, attack, velocity);
} }
//decay //decay
this._sig.targetRampTo(velocity * this.sustain, decay, attack + time); if (decay){
this._sig.targetRampTo(velocity * this.sustain, decay, attack + time);
}
return this; return this;
}; };
@ -286,7 +287,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
} else{ } else{
var curve = this._releaseCurve; var curve = this._releaseCurve;
if (Tone.isArray(curve)){ if (Tone.isArray(curve)){
this._sig.setRampPoint(time); this._sig.cancelAndHoldAtTime(time);
this._sig.setValueCurveAtTime(curve, time, release, currentValue); this._sig.setValueCurveAtTime(curve, time, release, currentValue);
} }
} }