2014-04-06 20:51:30 +00:00
|
|
|
define(["Tone/core/Tone"], function(Tone){
|
2014-04-05 22:05:42 +00:00
|
|
|
|
2014-06-17 15:40:01 +00:00
|
|
|
/**
|
|
|
|
* merge a left and a right channel into a single stereo channel
|
|
|
|
*
|
|
|
|
* instead of connecting to the input, connect to either the left, or right input
|
|
|
|
*
|
|
|
|
* default input for connect is left input
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @extends {Tone}
|
|
|
|
*/
|
2014-04-05 22:05:42 +00:00
|
|
|
Tone.Merge = function(){
|
2014-06-17 15:40:01 +00:00
|
|
|
|
2014-04-05 22:05:42 +00:00
|
|
|
Tone.call(this);
|
|
|
|
|
2014-06-17 15:40:01 +00:00
|
|
|
/**
|
|
|
|
* the left input channel
|
|
|
|
* also an alias for the input
|
|
|
|
* @type {GainNode}
|
|
|
|
*/
|
|
|
|
this.left = this.input;
|
|
|
|
/**
|
|
|
|
* the right input channel
|
|
|
|
* @type {GainNode}
|
|
|
|
*/
|
2014-04-05 22:05:42 +00:00
|
|
|
this.right = this.context.createGain();
|
2014-06-17 15:40:01 +00:00
|
|
|
/**
|
|
|
|
* the merger node for the two channels
|
|
|
|
* @type {ChannelMergerNode}
|
|
|
|
*/
|
2014-04-05 22:05:42 +00:00
|
|
|
this.merger = this.context.createChannelMerger(2);
|
|
|
|
|
|
|
|
//connections
|
|
|
|
this.left.connect(this.merger, 0, 0);
|
|
|
|
this.right.connect(this.merger, 0, 1);
|
|
|
|
this.merger.connect(this.output);
|
2014-06-17 15:40:01 +00:00
|
|
|
};
|
2014-04-05 22:05:42 +00:00
|
|
|
|
|
|
|
Tone.extend(Tone.Merge);
|
|
|
|
|
|
|
|
return Tone.Merge;
|
2014-06-17 15:40:01 +00:00
|
|
|
});
|