Tone.js/Tone/signal/Multiply.js

38 lines
829 B
JavaScript
Raw Normal View History

define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
2014-06-17 00:05:54 +00:00
/**
* Multiply the incoming signal by some factor
*
* @constructor
* @extends {Tone}
2014-06-17 15:42:38 +00:00
* @param {number=} value constant value to multiple
2014-06-17 00:05:54 +00:00
*/
Tone.Multiply = function(value){
2014-06-17 15:42:38 +00:00
/**
* the input node is the same as the output node
* it is also the GainNode which handles the scaling of incoming signal
*
* @type {GainNode}
*/
2014-06-15 21:38:59 +00:00
this.input = this.context.createGain();
2014-06-17 15:42:38 +00:00
/** @alias */
2014-06-15 21:38:59 +00:00
this.output = this.input;
2014-06-17 15:42:38 +00:00
//apply the inital scale factor
this.input.gain.value = this.defaultArg(value, 1);
2014-06-15 21:38:59 +00:00
};
Tone.extend(Tone.Multiply);
2014-06-17 00:05:54 +00:00
/**
* set the constant multiple
*
* @param {number} value
*/
Tone.Multiply.prototype.setValue = function(value){
this.input.gain.value = value;
2014-06-15 21:38:59 +00:00
};
return Tone.Multiply;
2014-06-15 21:38:59 +00:00
});