compute time string values for envelope attack/release

fixes #501
This commit is contained in:
Yotam Mann 2019-08-07 11:46:04 -04:00
parent cf31bb6bda
commit 507f095992

View file

@ -85,7 +85,7 @@ Tone.Synth.prototype._triggerEnvelopeAttack = function(time, velocity){
this.oscillator.start(time); this.oscillator.start(time);
//if there is no release portion, stop the oscillator //if there is no release portion, stop the oscillator
if (this.envelope.sustain === 0){ if (this.envelope.sustain === 0){
this.oscillator.stop(time + this.envelope.attack + this.envelope.decay); this.oscillator.stop(time + this.toSeconds(this.envelope.attack) + this.toSeconds(this.envelope.decay));
} }
return this; return this;
}; };
@ -99,7 +99,7 @@ Tone.Synth.prototype._triggerEnvelopeAttack = function(time, velocity){
Tone.Synth.prototype._triggerEnvelopeRelease = function(time){ Tone.Synth.prototype._triggerEnvelopeRelease = function(time){
time = this.toSeconds(time); time = this.toSeconds(time);
this.envelope.triggerRelease(time); this.envelope.triggerRelease(time);
this.oscillator.stop(time + this.envelope.release); this.oscillator.stop(time + this.toSeconds(this.envelope.release));
return this; return this;
}; };