2018-01-02 15:37:27 +00:00
|
|
|
define(["Tone/core/Tone", "Tone/core/Gain", "Tone/signal/SignalBase"], function(Tone) {
|
2016-02-27 16:16:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
2017-08-27 21:50:31 +00:00
|
|
|
* with a value of 0 and will not process nodes further down the graph.
|
2017-04-26 03:45:37 +00:00
|
|
|
* @extends {Tone.SignalBase}
|
2016-02-27 16:16:25 +00:00
|
|
|
*/
|
|
|
|
Tone.Zero = function(){
|
|
|
|
|
2017-04-26 03:45:37 +00:00
|
|
|
Tone.SignalBase.call(this);
|
|
|
|
|
2016-02-27 16:16:25 +00:00
|
|
|
/**
|
|
|
|
* The gain node
|
|
|
|
* @type {Tone.Gain}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
this._gain = this.input = this.output = new Tone.Gain();
|
|
|
|
|
2017-03-22 15:43:33 +00:00
|
|
|
this.context.getConstant(0).connect(this._gain);
|
2016-02-27 16:16:25 +00:00
|
|
|
};
|
|
|
|
|
2017-04-26 03:45:37 +00:00
|
|
|
Tone.extend(Tone.Zero, Tone.SignalBase);
|
2016-02-27 16:16:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* clean up
|
|
|
|
* @return {Tone.Zero} this
|
|
|
|
*/
|
|
|
|
Tone.Zero.prototype.dispose = function(){
|
2017-04-26 03:45:37 +00:00
|
|
|
Tone.SignalBase.prototype.dispose.call(this);
|
2016-02-27 16:22:26 +00:00
|
|
|
this._gain.dispose();
|
|
|
|
this._gain = null;
|
2016-02-27 16:16:25 +00:00
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
return Tone.Zero;
|
2017-08-27 21:50:31 +00:00
|
|
|
});
|