2014-09-21 17:37:08 +00:00
|
|
|
define(["Tone/core/Tone", "Tone/component/Merge"], function(Tone){
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/**
|
2015-07-02 00:19:58 +00:00
|
|
|
* @class Tone.Mono coerces the incoming mono or stereo signal into a mono signal
|
2015-07-04 19:25:37 +00:00
|
|
|
* where both left and right channels have the same value. This can be useful
|
|
|
|
* for [stereo imaging](https://en.wikipedia.org/wiki/Stereo_imaging).
|
2014-09-21 17:37:08 +00:00
|
|
|
*
|
|
|
|
* @extends {Tone}
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
Tone.Mono = function(){
|
2017-04-26 03:08:23 +00:00
|
|
|
|
|
|
|
Tone.call(this);
|
2016-09-20 03:02:42 +00:00
|
|
|
this.createInsOuts(1, 0);
|
2014-09-21 17:37:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* merge the signal
|
|
|
|
* @type {Tone.Merge}
|
|
|
|
* @private
|
|
|
|
*/
|
2015-03-03 15:26:46 +00:00
|
|
|
this._merge = this.output = new Tone.Merge();
|
2014-09-21 17:37:08 +00:00
|
|
|
|
|
|
|
this.input.connect(this._merge, 0, 0);
|
|
|
|
this.input.connect(this._merge, 0, 1);
|
|
|
|
this.input.gain.value = this.dbToGain(-10);
|
|
|
|
};
|
|
|
|
|
|
|
|
Tone.extend(Tone.Mono);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clean up
|
2015-06-14 00:54:29 +00:00
|
|
|
* @returns {Tone.Mono} this
|
2014-09-21 17:37:08 +00:00
|
|
|
*/
|
|
|
|
Tone.Mono.prototype.dispose = function(){
|
|
|
|
Tone.prototype.dispose.call(this);
|
|
|
|
this._merge.dispose();
|
|
|
|
this._merge = null;
|
2015-02-02 17:49:13 +00:00
|
|
|
return this;
|
2014-09-21 17:37:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return Tone.Mono;
|
|
|
|
});
|