mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-17 00:58:09 +00:00
43 lines
909 B
JavaScript
43 lines
909 B
JavaScript
define(["Tone/core/Tone"], function(Tone){
|
|
|
|
/**
|
|
* 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}
|
|
*/
|
|
Tone.Merge = function(){
|
|
|
|
Tone.call(this);
|
|
|
|
/**
|
|
* the left input channel
|
|
* also an alias for the input
|
|
* @type {GainNode}
|
|
*/
|
|
this.left = this.input;
|
|
/**
|
|
* the right input channel
|
|
* @type {GainNode}
|
|
*/
|
|
this.right = this.context.createGain();
|
|
/**
|
|
* the merger node for the two channels
|
|
* @type {ChannelMergerNode}
|
|
*/
|
|
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);
|
|
};
|
|
|
|
Tone.extend(Tone.Merge);
|
|
|
|
return Tone.Merge;
|
|
});
|