2014-04-04 17:07:16 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// ADD
|
|
|
|
//
|
2014-04-16 23:56:18 +00:00
|
|
|
// adds a value to the incoming signal
|
|
|
|
// can sum two signals or a signal and a constant
|
2014-04-04 17:07:16 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
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-04-16 23:56:18 +00:00
|
|
|
//@param {Tone.Signal|number} value
|
|
|
|
Tone.Add = function(value){
|
2014-04-05 22:05:42 +00:00
|
|
|
Tone.call(this);
|
2014-04-04 17:07:16 +00:00
|
|
|
|
2014-04-16 23:56:18 +00:00
|
|
|
if (typeof value === "number"){
|
|
|
|
this.value = new Tone.Signal(value);
|
|
|
|
} else {
|
|
|
|
this.value = value;
|
|
|
|
}
|
2014-04-04 17:07:16 +00:00
|
|
|
|
2014-04-05 22:05:42 +00:00
|
|
|
//connections
|
2014-04-16 23:56:18 +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-04-16 20:47:25 +00:00
|
|
|
//set the constant value
|
2014-04-16 23:56:18 +00:00
|
|
|
//@param {number} value
|
|
|
|
Tone.Add.prototype.setValue = function(value){
|
|
|
|
this.value.setValue(value);
|
2014-06-15 22:19:05 +00:00
|
|
|
};
|
2014-04-16 20:47:25 +00:00
|
|
|
|
2014-04-05 22:05:42 +00:00
|
|
|
return Tone.Add;
|
|
|
|
});
|