Tone.js/Tone/signal/Add.js

47 lines
815 B
JavaScript
Raw Normal View History

define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
2014-06-17 00:05:54 +00:00
/**
* Adds a value to an incoming signal
*
* @constructor
* @extends {Tone}
* @param {number} value
*/
Tone.Add = function(value){
Tone.call(this);
2014-06-17 00:05:54 +00:00
/**
* @private
* @type {Tone}
*/
this._value = new Tone.Signal(value);
//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
};
Tone.extend(Tone.Add);
2014-06-17 00:05:54 +00:00
/**
* set the constant
*
* @param {number} value
*/
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-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;
};
return Tone.Add;
});