mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
envelope uses Signal instead of TimelineSignal
they are equivalent now bc of the AudioParam shim
This commit is contained in:
parent
374365f2a8
commit
2d2424e639
1 changed files with 6 additions and 5 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue