2019-05-23 18:00:49 +00:00
|
|
|
import Tone from "../../core/Tone";
|
2019-01-27 18:05:20 +00:00
|
|
|
import "../component/Merge";
|
|
|
|
import "../core/AudioNode";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class Tone.Mono coerces the incoming mono or stereo signal into a mono signal
|
|
|
|
* where both left and right channels have the same value. This can be useful
|
|
|
|
* for [stereo imaging](https://en.wikipedia.org/wiki/Stereo_imaging).
|
|
|
|
*
|
|
|
|
* @extends {Tone.AudioNode}
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
Tone.Mono = function(){
|
|
|
|
|
|
|
|
Tone.AudioNode.call(this);
|
|
|
|
this.createInsOuts(1, 0);
|
2014-09-21 17:37:08 +00:00
|
|
|
|
|
|
|
/**
|
2019-01-27 18:05:20 +00:00
|
|
|
* merge the signal
|
|
|
|
* @type {Tone.Merge}
|
|
|
|
* @private
|
2014-09-21 17:37:08 +00:00
|
|
|
*/
|
2019-01-27 18:05:20 +00:00
|
|
|
this._merge = this.output = new Tone.Merge();
|
2017-04-26 03:08:23 +00:00
|
|
|
|
2019-01-28 16:02:15 +00:00
|
|
|
Tone.connect(this.input, this._merge, 0, 0);
|
|
|
|
Tone.connect(this.input, this._merge, 0, 1);
|
2019-01-27 18:05:20 +00:00
|
|
|
};
|
2014-09-21 17:37:08 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
Tone.extend(Tone.Mono, Tone.AudioNode);
|
2014-09-21 17:37:08 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
/**
|
|
|
|
* clean up
|
|
|
|
* @returns {Tone.Mono} this
|
|
|
|
*/
|
|
|
|
Tone.Mono.prototype.dispose = function(){
|
|
|
|
Tone.AudioNode.prototype.dispose.call(this);
|
|
|
|
this._merge.dispose();
|
|
|
|
this._merge = null;
|
|
|
|
return this;
|
|
|
|
};
|
2014-09-21 17:37:08 +00:00
|
|
|
|
2019-01-27 18:05:20 +00:00
|
|
|
export default Tone.Mono;
|
2014-09-21 17:37:08 +00:00
|
|
|
|