Tone.js/Tone/signal/Negate.js
2014-08-24 15:47:59 -04:00

41 lines
No EOL
804 B
JavaScript

define(["Tone/core/Tone", "Tone/signal/Multiply", "Tone/signal/Signal"], function(Tone){
/**
* @class Negate the incoming signal. i.e. an input signal of 10 will output -10
*
* @constructor
* @extends {Tone}
*/
Tone.Negate = function(){
/**
* negation is done by multiplying by -1
* @type {Tone.Multiply}
* @private
*/
this._multiply = new Tone.Multiply(-1);
/**
* the input and output
*/
this.input = this.output = this._multiply;
};
Tone.extend(Tone.Negate);
/**
* borrows the method from {@link Tone.Signal}
*
* @function
*/
Tone.Negate.prototype.connect = Tone.Signal.prototype.connect;
/**
* clean up
*/
Tone.Negate.prototype.dispose = function(){
this.input.disconnect();
this.input = null;
};
return Tone.Negate;
});