From 0604f91a73daec1278e8a2997d980cde6720907f Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 11 Sep 2023 09:34:45 -0400 Subject: [PATCH] Unison: Mono mode no longer stereo pans (#935) If you use the unison module and *don't* hook up the right output, we skip the unison stereo pan and just sum the voices onto L. --- src/UnisonHelper.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/UnisonHelper.h b/src/UnisonHelper.h index 65e3c03..77d151a 100644 --- a/src/UnisonHelper.h +++ b/src/UnisonHelper.h @@ -387,6 +387,8 @@ struct UnisonHelper : modules::XTModule, sst::rackhelpers::module_connector::Nei outputs[OUTPUT_L].setChannels(nChan); outputs[OUTPUT_R].setChannels(nChan); + bool stereoOut = outputs[OUTPUT_R].isConnected(); + if (samplePos == 0) { modAssist.setupMatrix(this); @@ -475,11 +477,18 @@ struct UnisonHelper : modules::XTModule, sst::rackhelpers::module_connector::Nei outputs[OUTPUT_VOCT_SUB1 + v].setVoltage(vo, p); auto iv = inputs[INPUT_SUB1 + v].getVoltage(p); - float pL, pR; - unisonSetup.attenuatedPanLaw(vi, pL, pR); + if (stereoOut) + { + float pL, pR; + unisonSetup.attenuatedPanLaw(vi, pL, pR); - outputL[svi] += iv * pL; - outputR[svi] += iv * pR; + outputL[svi] += iv * pL; + outputR[svi] += iv * pR; + } + else + { + outputL[svi] += iv; + } } } }