2014-04-16 23:56:18 +00:00
|
|
|
define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
2014-04-04 17:07:16 +00:00
|
|
|
|
2014-06-17 00:05:54 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to an incoming signal
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @extends {Tone}
|
|
|
|
* @param {number} value
|
|
|
|
*/
|
2014-04-16 23:56:18 +00:00
|
|
|
Tone.Add = function(value){
|
2014-04-05 22:05:42 +00:00
|
|
|
Tone.call(this);
|
2014-04-04 17:07:16 +00:00
|
|
|
|
2014-06-17 00:05:54 +00:00
|
|
|
/**
|
|
|
|
* @private
|
|
|
|
* @type {Tone}
|
|
|
|
*/
|
|
|
|
this._value = new Tone.Signal(value);
|
2014-04-04 17:07:16 +00:00
|
|
|
|
2014-04-05 22:05:42 +00:00
|
|
|
//connections
|
2014-06-17 00:05:54 +00:00
|
|
|
this.chain(this._value, this.input, this.output);
|
2014-06-15 21:38:59 +00:00
|
|
|
};
|
2014-04-05 22:05:42 +00:00
|
|
|
|
|
|
|
Tone.extend(Tone.Add);
|
2014-04-04 17:07:16 +00:00
|
|
|
|
2014-06-17 00:05:54 +00:00
|
|
|
/**
|
|
|
|
* set the constant
|
|
|
|
*
|
|
|
|
* @param {number} value
|
|
|
|
*/
|
2014-04-16 23:56:18 +00:00
|
|
|
Tone.Add.prototype.setValue = function(value){
|
2014-06-17 00:05:54 +00:00
|
|
|
this._value.setValue(value);
|
2014-06-15 22:19:05 +00:00
|
|
|
};
|
2014-04-16 20:47:25 +00:00
|
|
|
|
2014-06-20 04:38:14 +00:00
|
|
|
/**
|
|
|
|
* dispose method
|
|
|
|
*/
|
|
|
|
Tone.Add.prototype.dispose = function(){
|
|
|
|
this._value.dispose();
|
|
|
|
this.input.disconnect();
|
|
|
|
this.output.disconnect();
|
|
|
|
this._value = null;
|
|
|
|
this.input = null;
|
|
|
|
this.output = null;
|
|
|
|
};
|
|
|
|
|
2014-04-05 22:05:42 +00:00
|
|
|
return Tone.Add;
|
|
|
|
});
|