Tone.js/Tone/effect/StereoXFeedbackEffect.ts

38 lines
1.6 KiB
TypeScript
Raw Normal View History

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";
export interface StereoXFeedbackEffectOptions extends StereoFeedbackEffectOptions {
2019-11-04 23:59:32 +00:00
feedback: NormalRange;
}
/**
* 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.
* ```
* +--------------------------------+ feedbackL <-----------------------------------+
2019-11-04 23:59:32 +00:00
* | |
* +--> +-----> +----> +-----+
* feedbackMerge +--> split (EFFECT) merge +--> feedbackSplit | |
* +--> +-----> +----> +---+ |
* | |
* +--------------------------------+ feedbackR <-------------------------------------+
2019-11-04 23:59:32 +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
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
this._feedbackR.disconnect();
this._feedbackR.connect(this._feedbackMerge, 0, 0);
2019-11-04 23:59:32 +00:00
readOnly(this, ["feedback"]);
}
}