2017-10-21 23:02:46 +00:00
|
|
|
define(["Tone/core/Tone", "Tone/effect/StereoEffect", "Tone/effect/FeedbackEffect"], function(Tone){
|
2014-09-01 16:52:13 +00:00
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class Just like a stereo feedback effect, but the feedback is routed from left to right
|
|
|
|
* and right to left instead of on the same channel.
|
|
|
|
*
|
|
|
|
* @constructor
|
2017-04-26 03:18:08 +00:00
|
|
|
* @extends {Tone.StereoEffect}
|
2014-09-01 16:52:13 +00:00
|
|
|
*/
|
|
|
|
Tone.StereoXFeedbackEffect = function(){
|
|
|
|
|
2017-04-26 03:18:08 +00:00
|
|
|
var options = Tone.defaults(arguments, ["feedback"], Tone.FeedbackEffect);
|
2014-09-01 16:52:13 +00:00
|
|
|
Tone.StereoEffect.call(this, options);
|
|
|
|
|
|
|
|
/**
|
2015-06-22 05:20:57 +00:00
|
|
|
* The amount of feedback from the output
|
|
|
|
* back into the input of the effect (routed
|
|
|
|
* across left and right channels).
|
|
|
|
* @type {NormalRange}
|
|
|
|
* @signal
|
2014-09-01 16:52:13 +00:00
|
|
|
*/
|
2015-06-27 21:25:19 +00:00
|
|
|
this.feedback = new Tone.Signal(options.feedback, Tone.Type.NormalRange);
|
2014-09-01 16:52:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* the left side feeback
|
2016-09-20 03:53:07 +00:00
|
|
|
* @type {Tone.Gain}
|
2014-09-01 16:52:13 +00:00
|
|
|
* @private
|
|
|
|
*/
|
2016-09-20 03:53:07 +00:00
|
|
|
this._feedbackLR = new Tone.Gain();
|
2014-09-01 16:52:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* the right side feeback
|
2016-09-20 03:53:07 +00:00
|
|
|
* @type {Tone.Gain}
|
2014-09-01 16:52:13 +00:00
|
|
|
* @private
|
|
|
|
*/
|
2016-09-20 03:53:07 +00:00
|
|
|
this._feedbackRL = new Tone.Gain();
|
2014-09-01 16:52:13 +00:00
|
|
|
|
|
|
|
//connect it up
|
2014-12-01 02:32:09 +00:00
|
|
|
this.effectReturnL.chain(this._feedbackLR, this.effectSendR);
|
|
|
|
this.effectReturnR.chain(this._feedbackRL, this.effectSendL);
|
2014-12-01 02:20:12 +00:00
|
|
|
this.feedback.fan(this._feedbackLR.gain, this._feedbackRL.gain);
|
2015-04-18 14:54:08 +00:00
|
|
|
this._readOnly(["feedback"]);
|
2014-09-01 16:52:13 +00:00
|
|
|
};
|
|
|
|
|
2017-04-26 03:18:08 +00:00
|
|
|
Tone.extend(Tone.StereoXFeedbackEffect, Tone.StereoEffect);
|
2014-09-01 16:52:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* clean up
|
2015-06-14 00:54:29 +00:00
|
|
|
* @returns {Tone.StereoXFeedbackEffect} this
|
2014-09-01 16:52:13 +00:00
|
|
|
*/
|
|
|
|
Tone.StereoXFeedbackEffect.prototype.dispose = function(){
|
|
|
|
Tone.StereoEffect.prototype.dispose.call(this);
|
2015-04-18 14:54:08 +00:00
|
|
|
this._writable(["feedback"]);
|
2014-09-01 16:52:13 +00:00
|
|
|
this.feedback.dispose();
|
|
|
|
this.feedback = null;
|
2016-09-20 03:53:07 +00:00
|
|
|
this._feedbackLR.dispose();
|
2014-09-01 16:52:13 +00:00
|
|
|
this._feedbackLR = null;
|
2016-09-20 03:53:07 +00:00
|
|
|
this._feedbackRL.dispose();
|
2014-09-01 16:52:13 +00:00
|
|
|
this._feedbackRL = null;
|
2015-02-02 18:22:16 +00:00
|
|
|
return this;
|
2014-09-01 16:52:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return Tone.StereoXFeedbackEffect;
|
2017-10-21 23:02:46 +00:00
|
|
|
});
|