mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-15 16:17:58 +00:00
optimization to turn off oscillator after play
This commit is contained in:
parent
55eed8c295
commit
031dc98898
1 changed files with 3 additions and 0 deletions
|
@ -92,6 +92,9 @@ define(["Tone/core/Tone", "Tone/source/OmniOscillator", "Tone/instrument/Instrum
|
||||||
this.oscillator.frequency.exponentialRampToValueAtTime(note, time + this.toSeconds(this.pitchDecay));
|
this.oscillator.frequency.exponentialRampToValueAtTime(note, time + this.toSeconds(this.pitchDecay));
|
||||||
this.envelope.triggerAttack(time, velocity);
|
this.envelope.triggerAttack(time, velocity);
|
||||||
this.oscillator.start(time);
|
this.oscillator.start(time);
|
||||||
|
if (this.envelope.sustain === 0){
|
||||||
|
this.oscillator.stop(time + this.envelope.attack + this.envelope.decay);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue