diff --git a/Tone/instrument/PolySynth.test.ts b/Tone/instrument/PolySynth.test.ts index 05cc63c8..a9013720 100644 --- a/Tone/instrument/PolySynth.test.ts +++ b/Tone/instrument/PolySynth.test.ts @@ -278,6 +278,13 @@ describe("PolySynth", () => { polySynth.dispose(); }); + it("throws an error when used without a monophonic synth", () => { + expect(() => { + // @ts-ignore + new PolySynth(PluckSynth); + }).throws(Error) + }); + it("can pass in the volume", () => { const polySynth = new PolySynth({ volume: -12, diff --git a/Tone/instrument/PolySynth.ts b/Tone/instrument/PolySynth.ts index 26780486..90229b40 100644 --- a/Tone/instrument/PolySynth.ts +++ b/Tone/instrument/PolySynth.ts @@ -176,6 +176,7 @@ export class PolySynth = Synth> extends Instrument context: this.context, onsilence: this._makeVoiceAvailable.bind(this), })); + assert(voice instanceof Monophonic, "Voice must extend Monophonic class"); voice.connect(this.output); this._voices.push(voice); return voice;