Tone.js/Tone/signal/Split.js

48 lines
940 B
JavaScript
Raw Normal View History

2014-04-06 20:51:30 +00:00
define(["Tone/core/Tone"], function(Tone){
2014-06-17 15:48:17 +00:00
/**
2014-07-04 17:47:56 +00:00
* @class Split the incoming signal into left and right channels
*
2014-06-17 15:48:17 +00:00
* @constructor
* @extends {Tone}
*/
Tone.Split = function(){
Tone.call(this);
2014-06-22 16:33:21 +00:00
/**
* @type {ChannelSplitterNode}
*/
this.splitter = this.context.createChannelSplitter(2);
2014-06-17 15:48:17 +00:00
/**
* left channel output
* @type {GainNode}
*/
this.left = this.output;
/**
* the right channel output
* @type {GainNode}
*/
this.right = this.context.createGain();
//connections
this.input.connect(this.splitter);
2014-06-18 19:39:10 +00:00
this.splitter.connect(this.left, 0, 0);
this.splitter.connect(this.right, 1, 0);
2014-06-17 15:48:17 +00:00
};
Tone.extend(Tone.Split);
2014-06-20 04:38:14 +00:00
/**
* dispose method
*/
2014-06-21 17:09:46 +00:00
Tone.Split.prototype.dispose = function(){
this.splitter.disconnect();
2014-06-20 04:38:14 +00:00
this.input.disconnect();
this.output.disconnect();
2014-06-21 17:09:46 +00:00
this.splitter = null;
2014-06-20 04:38:14 +00:00
this.input = null;
this.output = null;
};
return Tone.Split;
});