Skip to content

Commit

Permalink
move a few more functions to base class
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamPorcineFudgepuppy committed Jul 13, 2024
1 parent ca89a22 commit 74b2369
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ComputerscareComplexTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<cpx::CompolyModeParam>(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<cpx::CompolyPortInfo<MAIN_OUTPUT_MODE,0>>(COMPOLY_MAIN_OUT_A, "f(z)");
configOutput<cpx::CompolyPortInfo<MAIN_OUTPUT_MODE,1>>(COMPOLY_MAIN_OUT_B, "f(z)");

}
void process(const ProcessArgs &args) override {
Expand Down
36 changes: 36 additions & 0 deletions src/complex/ComputerscareComplexBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> inputCompolyphonyChannels) {
int numInputsToConsider = inputCompolyphonyChannels.size();

Expand Down

0 comments on commit 74b2369

Please sign in to comment.