Tone.js/Tone/signal/Merge.js

44 lines
909 B
JavaScript
Raw Normal View History

2014-04-06 20:51:30 +00:00
define(["Tone/core/Tone"], function(Tone){
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}
*/
Tone.Merge = function(){
2014-06-17 15:40:01 +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}
*/
this.right = this.context.createGain();
2014-06-17 15:40:01 +00:00
/**
* 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);
2014-06-17 15:40:01 +00:00
};
Tone.extend(Tone.Merge);
return Tone.Merge;
2014-06-17 15:40:01 +00:00
});