2019-01-27 18:05:20 +00:00
|
|
|
import Tone from "../core/Tone";
|
|
|
|
import "../core/Gain";
|
|
|
|
import "../signal/SignalBase";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class Tone.Zero outputs 0's at audio-rate. The reason this has to be
|
|
|
|
* it's own class is that many browsers optimize out Tone.Signal
|
|
|
|
* with a value of 0 and will not process nodes further down the graph.
|
|
|
|
* @extends {Tone.SignalBase}
|
|
|
|
*/
|
|
|
|
Tone.Zero = function(){
|
|
|
|
|
|
|
|
Tone.SignalBase.call(this);
|
2016-02-27 16:16:25 +00:00
|
|
|
|
|
|
|
/**
|
2019-01-27 18:05:20 +00:00
|
|
|
* The gain node
|
|
|
|
* @type {Tone.Gain}
|
|
|
|
* @private
|
2016-02-27 16:16:25 +00:00
|
|
|
*/
|
2019-01-27 18:05:20 +00:00
|
|
|
this._gain = this.input = this.output = new Tone.Gain();
|
2016-02-27 16:16:25 +00:00
|
|
|
|
2019-01-28 16:02:15 +00:00
|
|
|
Tone.connect(this.context.getConstant(0), this._gain);
|
2019-01-27 18:05:20 +00:00
|
|
|
};
|
2017-04-26 03:45:37 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
Tone.extend(Tone.Zero, Tone.SignalBase);
|
2016-02-27 16:16:25 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
/**
|
|
|
|
* clean up
|
|
|
|
* @return {Tone.Zero} this
|
|
|
|
*/
|
|
|
|
Tone.Zero.prototype.dispose = function(){
|
|
|
|
Tone.SignalBase.prototype.dispose.call(this);
|
|
|
|
this._gain.dispose();
|
|
|
|
this._gain = null;
|
|
|
|
return this;
|
|
|
|
};
|
2016-02-27 16:16:25 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
export default Tone.Zero;
|
2016-02-27 16:16:25 +00:00
|
|
|
|