UNPKG

1.89 kBJavaScriptView Raw
1import { Effect } from "./Effect.js";
2import { MidSideSplit } from "../component/channel/MidSideSplit.js";
3import { MidSideMerge } from "../component/channel/MidSideMerge.js";
4/**
5 * Mid/Side processing separates the the 'mid' signal
6 * (which comes out of both the left and the right channel)
7 * and the 'side' (which only comes out of the the side channels)
8 * and effects them separately before being recombined.
9 * Applies a Mid/Side seperation and recombination.
10 * Algorithm found in [kvraudio forums](http://www.kvraudio.com/forum/viewtopic.php?t=212587).
11 * This is a base-class for Mid/Side Effects.
12 * @category Effect
13 */
14export class MidSideEffect extends Effect {
15 constructor(options) {
16 super(options);
17 this.name = "MidSideEffect";
18 this._midSideMerge = new MidSideMerge({ context: this.context });
19 this._midSideSplit = new MidSideSplit({ context: this.context });
20 this._midSend = this._midSideSplit.mid;
21 this._sideSend = this._midSideSplit.side;
22 this._midReturn = this._midSideMerge.mid;
23 this._sideReturn = this._midSideMerge.side;
24 // the connections
25 this.effectSend.connect(this._midSideSplit);
26 this._midSideMerge.connect(this.effectReturn);
27 }
28 /**
29 * Connect the mid chain of the effect
30 */
31 connectEffectMid(...nodes) {
32 this._midSend.chain(...nodes, this._midReturn);
33 }
34 /**
35 * Connect the side chain of the effect
36 */
37 connectEffectSide(...nodes) {
38 this._sideSend.chain(...nodes, this._sideReturn);
39 }
40 dispose() {
41 super.dispose();
42 this._midSideSplit.dispose();
43 this._midSideMerge.dispose();
44 this._midSend.dispose();
45 this._sideSend.dispose();
46 this._midReturn.dispose();
47 this._sideReturn.dispose();
48 return this;
49 }
50}
51//# sourceMappingURL=MidSideEffect.js.map
\No newline at end of file