adding triggerAttackRelease method

Instrument one does not work with MultiSampler since a note is required
as the first argument
This commit is contained in:
Yotam Mann 2017-06-16 17:27:30 -04:00
parent 91734d23c7
commit 0a42b3ef54

View file

@ -148,6 +148,22 @@ define(["Tone/core/Tone", "Tone/instrument/Instrument", "Tone/core/Buffers", "To
}
};
/**
* Invoke the attack phase, then after the duration, invoke the release.
* @param {Frequency} note The note to play
* @param {Time} duration The time the note should be held
* @param {Time=} time When to start the attack
* @param {NormalRange} [velocity=1] The velocity of the attack
* @return {Tone.MultiSampler} this
*/
Tone.MultiSampler.prototype.triggerAttackRelease = function(note, duration, time, velocity){
time = this.toSeconds(time);
duration = this.toSeconds(duration);
this.triggerAttack(note, time, velocity);
this.triggerRelease(note, time + duration);
return this;
};
/**
* Add a note to the sampler.
* @param {Note|Midi} note The buffer's pitch.