From 74b236960eebf9d44588f3f35ed9c5362c4b6cc8 Mon Sep 17 00:00:00 2001 From: AdamPorcineFudgepuppy <> Date: Sat, 13 Jul 2024 16:35:40 -0500 Subject: [PATCH] move a few more functions to base class --- src/ComputerscareComplexTransformer.cpp | 8 ++---- src/complex/ComputerscareComplexBase.cpp | 36 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/ComputerscareComplexTransformer.cpp b/src/ComputerscareComplexTransformer.cpp index c5a40bd..a0f8827 100644 --- a/src/ComputerscareComplexTransformer.cpp +++ b/src/ComputerscareComplexTransformer.cpp @@ -64,15 +64,13 @@ struct ComputerscareComplexTransformer : ComputerscareComplexBase { getParamQuantity(COMPOLY_CHANNELS)->randomizeEnabled = false; getParamQuantity(COMPOLY_CHANNELS)->resetEnabled = false; - configParam(MAIN_OUTPUT_MODE,0.f,3.f,0.f); + configParam(MAIN_OUTPUT_MODE,0.f,3.f,0.f,"Main Output Mode"); configParam(MAIN_INPUT_MODE,0.f,3.f,0.f); configParam(MAIN_SCALE_INPUT_MODE,0.f,3.f,0.f); configParam(MAIN_OFFSET_INPUT_MODE,0.f,3.f,0.f); - - - configOutput(COMPOLY_MAIN_OUT_A, "Main A"); - configOutput(COMPOLY_MAIN_OUT_B, "Main B"); + configOutput>(COMPOLY_MAIN_OUT_A, "f(z)"); + configOutput>(COMPOLY_MAIN_OUT_B, "f(z)"); } void process(const ProcessArgs &args) override { diff --git a/src/complex/ComputerscareComplexBase.cpp b/src/complex/ComputerscareComplexBase.cpp index 1b6d50b..d06757d 100644 --- a/src/complex/ComputerscareComplexBase.cpp +++ b/src/complex/ComputerscareComplexBase.cpp @@ -25,6 +25,42 @@ struct ComputerscareComplexBase : ComputerscareMenuParamModule { WRAP_STALL }; + void setOutputVoltages(int outIndex,int outMode,int compChannelIndex,float x, float y, float r, float theta) { + int outputBlock = compChannelIndex > 7 ? 1 : 0; + if(outMode==0) { + //interleaved rectangular + outputs[outIndex+outputBlock].setVoltage(x,(compChannelIndex*2) % 16); + outputs[outIndex+outputBlock].setVoltage(y,(compChannelIndex*2+1) % 16); + } else if(outMode==1) { + //interleaved polar + outputs[outIndex+outputBlock].setVoltage(r,(compChannelIndex*2) % 16); + outputs[outIndex+outputBlock].setVoltage(theta,(compChannelIndex*2+1) % 16); + } else if(outMode==2) { + //separated rectangular + outputs[outIndex].setVoltage(x,compChannelIndex); + outputs[outIndex+1].setVoltage(y,compChannelIndex); + } else if(outMode==3) { + //separated polar + outputs[outIndex].setVoltage(r,compChannelIndex); + outputs[outIndex+1].setVoltage(theta,compChannelIndex); + } + } + + void setOutputChannels(int outIndex,int outMode,int compolyChannels) { + if(outMode==0 || outMode ==1) { + //interleaved + int numTotalPolyChannels = compolyChannels*2; + int numChannels1 = numTotalPolyChannels >= 16 ? 16 : numTotalPolyChannels; + int numChannels2 = numTotalPolyChannels >= 16 ? numTotalPolyChannels-16 : 0; + + outputs[outIndex+0].setChannels(numChannels1); + outputs[outIndex+1].setChannels(numChannels2); + } else { + outputs[outIndex+0].setChannels(compolyChannels); + outputs[outIndex+1].setChannels(compolyChannels); + } + } + int calcOutputCompolyphony(int knobSetting,std::vector inputCompolyphonyChannels) { int numInputsToConsider = inputCompolyphonyChannels.size();