From fdcbea3714c4b152156da4878c3382dd4431e198 Mon Sep 17 00:00:00 2001 From: garrettmichaelgeorge Date: Wed, 17 Mar 2021 14:55:45 -0400 Subject: [PATCH] Add failing tests for fanIn --- Tone/core/context/ToneAudioNode.test.ts | 21 ++++++++++++++++++++- Tone/core/context/ToneAudioNode.ts | 14 ++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Tone/core/context/ToneAudioNode.test.ts b/Tone/core/context/ToneAudioNode.test.ts index 02880753..d741e31c 100644 --- a/Tone/core/context/ToneAudioNode.test.ts +++ b/Tone/core/context/ToneAudioNode.test.ts @@ -3,7 +3,7 @@ import { Merge } from "Tone/component"; import { Split } from "Tone/component/channel/Split"; import { Oscillator } from "Tone/source"; import { Gain } from "./Gain"; -import { connect, disconnect } from "./ToneAudioNode"; +import { connect, disconnect, fanIn } from "./ToneAudioNode"; import { PassAudio } from "test/helper/PassAudio"; import { Offline } from "test/helper/Offline"; @@ -218,6 +218,16 @@ describe("ToneAudioNode", () => { disconnect(input); }, false); }); + + it("can fan in multiple nodes to a destination", async () => { + return PassAudio(input => { + const input0 = new Gain(); + const input1 = new Gain(); + const input2 = new Gain(); + const output = new Gain(); + fanIn(output, input0, input1, input2); + }); + }); it("can connect one channel to another", () => { return PassAudio(input => { @@ -320,6 +330,15 @@ describe("ToneAudioNode", () => { disconnect(gain, output); }); }); + + it("can fan in multiple nodes to a destination", async () => { + const output = new Gain(); + const input0 = new Gain(); + const input1 = new Gain(); + const input2 = new Gain(); + fanIn(output, input0, input1, input2); + expect(output.numberOfInputs).to.equal(3); + }); }); }); diff --git a/Tone/core/context/ToneAudioNode.ts b/Tone/core/context/ToneAudioNode.ts index da7a1727..976f9119 100644 --- a/Tone/core/context/ToneAudioNode.ts +++ b/Tone/core/context/ToneAudioNode.ts @@ -257,6 +257,7 @@ export abstract class ToneAudioNode connect(srcNode, dstNode)); +}