Tone.js/Tone/component/AmplitudeEnvelope.js

31 lines
846 B
JavaScript
Raw Normal View History

2014-09-20 19:18:08 +00:00
define(["Tone/core/Tone", "Tone/component/Envelope"], function(Tone){
"use strict";
/**
* @class An Envelope connected to a gain node which can be used as an amplitude envelope.
*
* @constructor
* @extends {Tone.Envelope}
2014-12-02 06:42:08 +00:00
* @param {Tone.Time|Object} [attack=0.01] the attack time in seconds
* @param {Tone.Time} [decay=0.1] the decay time in seconds
* @param {number} [sustain=0.5] a percentage (0-1) of the full amplitude
* @param {Tone.Time} [release=1] the release time in seconds
2014-09-20 19:18:08 +00:00
*/
Tone.AmplitudeEnvelope = function(){
Tone.Envelope.apply(this, arguments);
/**
* the input node
* @type {GainNode}
*/
2014-11-02 01:55:19 +00:00
this.input = this.output = this.context.createGain();
this._sig.connect(this.output.gain);
2014-09-20 19:18:08 +00:00
};
Tone.extend(Tone.AmplitudeEnvelope, Tone.Envelope);
return Tone.AmplitudeEnvelope;
});