Tone.js/Tone/signal/Negate.js

41 lines
804 B
JavaScript
Raw Normal View History

2014-08-24 19:47:59 +00:00
define(["Tone/core/Tone", "Tone/signal/Multiply", "Tone/signal/Signal"], function(Tone){
2014-07-02 21:08:59 +00:00
/**
2014-07-04 17:47:56 +00:00
* @class Negate the incoming signal. i.e. an input signal of 10 will output -10
2014-07-02 21:08:59 +00:00
*
* @constructor
* @extends {Tone}
*/
2014-07-22 16:48:22 +00:00
Tone.Negate = function(){
2014-07-02 21:08:59 +00:00
/**
* 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;
2014-07-02 21:08:59 +00:00
/**
* clean up
*/
Tone.Negate.prototype.dispose = function(){
this.input.disconnect();
this.input = null;
};
return Tone.Negate;
});