From efe652456a5600d88334fa0940ecf951b39234d4 Mon Sep 17 00:00:00 2001 From: kevinstadler Date: Tue, 19 Mar 2024 13:50:37 +0100 Subject: [PATCH] Unconditionally connect played back units to output (refs #95) --- src/processing/sound/Engine.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/processing/sound/Engine.java b/src/processing/sound/Engine.java index d0bb6dd..5cab3d9 100644 --- a/src/processing/sound/Engine.java +++ b/src/processing/sound/Engine.java @@ -528,18 +528,16 @@ protected void disconnectFromOutput(int channel, UnitSource source, int part) { } protected void play(UnitSource source) { - // check if unit is already connected + // add unit to synth UnitGenerator generator = source.getUnitGenerator(); - if (!this.addedUnits.contains(generator)) { - this.synth.add(generator); - this.addedUnits.add(generator); - for (int i = 0; i < source.getOutput().getNumParts(); i++) { - this.connectToOutput((this.outputChannel + i) % this.synth.getAudioDeviceManager().getMaxOutputChannels(this.outputDevice), source, i); + this.add(generator); + // and connect to output(s) + for (int i = 0; i < source.getOutput().getNumParts(); i++) { + this.connectToOutput((this.outputChannel + i) % this.synth.getAudioDeviceManager().getMaxOutputChannels(this.outputDevice), source, i); // source.getOutput().connect(i, this.volume[(this.outputChannel + i) % this.synth.getAudioDeviceManager().getMaxOutputChannels(this.outputDevice)].inputA, 0); - if (this.multiChannelMode) { - // only add the first (left) channel - break; - } + if (this.multiChannelMode) { + // only add the first (left) channel + break; } } }