mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-15 08:17:07 +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.envelope.triggerAttack(time, velocity);
|
||||
this.oscillator.start(time);
|
||||
if (this.envelope.sustain === 0){
|
||||
this.oscillator.stop(time + this.envelope.attack + this.envelope.decay);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue