2019-11-05 00:09:13 +00:00
|
|
|
import { StereoFeedbackEffect, StereoFeedbackEffectOptions } from "./StereoFeedbackEffect";
|
2019-11-04 23:59:32 +00:00
|
|
|
import { NormalRange } from "../core/type/Units";
|
|
|
|
import { readOnly } from "../core/util/Interface";
|
|
|
|
|
2019-11-05 00:09:13 +00:00
|
|
|
export interface StereoXFeedbackEffectOptions extends StereoFeedbackEffectOptions {
|
2019-11-04 23:59:32 +00:00
|
|
|
feedback: NormalRange;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-11-05 00:09:13 +00:00
|
|
|
* Just like a [[StereoFeedbackEffect]], but the feedback is routed from left to right
|
2019-11-04 23:59:32 +00:00
|
|
|
* and right to left instead of on the same channel.
|
|
|
|
* ```
|
2019-11-05 00:09:13 +00:00
|
|
|
* +--------------------------------+ feedbackL <-----------------------------------+
|
2019-11-04 23:59:32 +00:00
|
|
|
* | |
|
|
|
|
* +--> +-----> +----> +-----+
|
|
|
|
* feedbackMerge +--> split (EFFECT) merge +--> feedbackSplit | |
|
|
|
|
* +--> +-----> +----> +---+ |
|
|
|
|
* | |
|
2019-11-05 00:09:13 +00:00
|
|
|
* +--------------------------------+ feedbackR <-------------------------------------+
|
2019-11-04 23:59:32 +00:00
|
|
|
* ```
|
|
|
|
*/
|
2019-11-05 00:09:13 +00:00
|
|
|
export class StereoXFeedbackEffect<Options extends StereoXFeedbackEffectOptions> extends StereoFeedbackEffect<Options> {
|
2019-11-04 23:59:32 +00:00
|
|
|
|
|
|
|
constructor(options: StereoXFeedbackEffectOptions) {
|
|
|
|
|
|
|
|
super(options);
|
|
|
|
// the left output connected to the right input
|
2019-11-05 00:09:13 +00:00
|
|
|
this._feedbackL.disconnect();
|
|
|
|
this._feedbackL.connect(this._feedbackMerge, 0, 1);
|
2019-11-04 23:59:32 +00:00
|
|
|
|
|
|
|
// the left output connected to the right input
|
2019-11-05 00:09:13 +00:00
|
|
|
this._feedbackR.disconnect();
|
|
|
|
this._feedbackR.connect(this._feedbackMerge, 0, 0);
|
2019-11-04 23:59:32 +00:00
|
|
|
|
|
|
|
readOnly(this, ["feedback"]);
|
|
|
|
}
|
|
|
|
}
|