Skip to content

Commit

Permalink
Update to V2.0.3
Browse files Browse the repository at this point in the history
Removed some leftover extra code on VCA and QUADVCA modules that caused wrong behavior when using the CV Level ports
  • Loading branch information
AScustomWorks committed Apr 9, 2022
1 parent 771e499 commit 9ad1350
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 49 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Buy them on the [VCV plugin library](https://vcvrack.com/plugins.html#Alfredo%20

# AS modules

### V 2.0.3

Removed some leftover extra code on VCA and QUADVCA modules that caused wrong behavior when using the CV Level ports (thanks to circadiansound for finding the bug)

### V 2.0.2

Updated component grahpics to V2 look, some code cleanup and tooltips added to all the ports, switches and buttons, also readme.md and licence
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"slug": "AS",
"version": "2.0.2",
"version": "2.0.3",
"license": "MIT",
"name": "AS",
"brand": "AS",
Expand Down
47 changes: 16 additions & 31 deletions src/QuadVCA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ struct QuadVCA : Module {
configSwitch(MODE3_PARAM, 0.0f, 1.0f, 1.0f, "CH 3 Response", {"Exponential", "Linear"});
configSwitch(MODE4_PARAM, 0.0f, 1.0f, 1.0f, "CH 4 Response", {"Exponential", "Linear"});
//inputs
configInput(GAIN1_CV_INPUT, "CH 1 Response CV");
configInput(GAIN2_CV_INPUT, "CH 2 Response CV");
configInput(GAIN3_CV_INPUT, "CH 3 Response CV");
configInput(GAIN4_CV_INPUT, "CH 4 Response CV");
configInput(GAIN1_CV_INPUT, "CH 1 Gain CV");
configInput(GAIN2_CV_INPUT, "CH 2 Gain CV");
configInput(GAIN3_CV_INPUT, "CH 3 Gain CV");
configInput(GAIN4_CV_INPUT, "CH 4 Gain CV");
configInput(IN1_INPUT, "CH 1");
configInput(IN2_INPUT, "CH 2");
configInput(IN3_INPUT, "CH 3");
Expand All @@ -92,19 +92,15 @@ struct QuadVCA : Module {
void process(const ProcessArgs &args) override {
//QuadVCA 1
float out = 0.0;
v1 = inputs[IN1_INPUT].getVoltage() * params[GAIN1_PARAM].getValue();

if(inputs[GAIN1_CV_INPUT].getVoltage()){
env1_mode_cv =! env1_mode_cv;
params[MODE1_PARAM].setValue(env1_mode_cv);
}
if(inputs[GAIN1_CV_INPUT].isConnected()){
v1 = inputs[IN1_INPUT].getVoltage() * params[GAIN1_PARAM].getValue();
//if(inputs[GAIN1_CV_INPUT].isConnected()){
if(params[MODE1_PARAM].getValue()==1){
v1 *= clamp(inputs[GAIN1_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f);
}else{
v1 *= rescale(powf(expBase, clamp(inputs[GAIN1_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f)), 1.0f, expBase, 0.0f, 1.0f);
}
}
//}
out+=v1;
lights[GAIN1_LIGHT].setSmoothBrightness(fmaxf(0.0f, out / 5.0f), args.sampleTime);
if (outputs[OUT1_OUTPUT].isConnected()) {
Expand All @@ -113,56 +109,45 @@ struct QuadVCA : Module {
}
//QuadVCA 2
v2 = inputs[IN2_INPUT].getVoltage() * params[GAIN2_PARAM].getValue();

if(inputs[GAIN2_CV_INPUT].getVoltage()){
env2_mode_cv =! env2_mode_cv;
params[MODE2_PARAM].setValue(env2_mode_cv);
}
if(inputs[GAIN2_CV_INPUT].isConnected()){
//if(inputs[GAIN2_CV_INPUT].isConnected()){
if(params[MODE2_PARAM].getValue()){
v2 *= clamp(inputs[GAIN2_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f);
}else{
v2 *= rescale(powf(expBase, clamp(inputs[GAIN2_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f)), 1.0f, expBase, 0.0f, 1.0f);
}
}
//}
out+=v2;
lights[GAIN2_LIGHT].setSmoothBrightness(fmaxf(0.0f, out / 5.0f), args.sampleTime);
if (outputs[OUT2_OUTPUT].isConnected()) {
outputs[OUT2_OUTPUT].setVoltage(out);
out = 0.0f;
}
//QuadVCA 3
v3 = inputs[IN3_INPUT].getVoltage() * params[GAIN3_PARAM].getValue();
if(inputs[GAIN3_CV_INPUT].getVoltage()){
env3_mode_cv =! env3_mode_cv;
params[MODE3_PARAM].setValue(env3_mode_cv);
}
if(inputs[GAIN3_CV_INPUT].isConnected()){

v3 = inputs[IN3_INPUT].getVoltage() * params[GAIN3_PARAM].getValue();
//if(inputs[GAIN3_CV_INPUT].isConnected()){
if(params[MODE3_PARAM].getValue()){
v3 *= clamp(inputs[GAIN3_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f);
}else{
v3 *= rescale(powf(expBase, clamp(inputs[GAIN3_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f)), 1.0f, expBase, 0.0f, 1.0f);
}
}
//}
out+=v3;
lights[GAIN3_LIGHT].setSmoothBrightness(fmaxf(0.0f, out / 5.0f), args.sampleTime);
if (outputs[OUT3_OUTPUT].isConnected()) {
outputs[OUT3_OUTPUT].setVoltage(out);
out = 0.0f;
}
//QuadVCA 4

v4 = inputs[IN4_INPUT].getVoltage() * params[GAIN4_PARAM].getValue();
if(inputs[GAIN4_CV_INPUT].getVoltage()){
env4_mode_cv =! env4_mode_cv;
params[MODE4_PARAM].setValue(env4_mode_cv);
}
if(inputs[GAIN4_CV_INPUT].isConnected()){
//if(inputs[GAIN4_CV_INPUT].isConnected()){
if(params[MODE4_PARAM].getValue()){
v4 *= clamp(inputs[GAIN4_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f);
}else{
v4 *= rescale(powf(expBase, clamp(inputs[GAIN4_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f)), 1.0f, expBase, 0.0f, 1.0f);
}
}
//}
out+=v4;
lights[GAIN4_LIGHT].setSmoothBrightness(fmaxf(0.0f, out / 5.0f), args.sampleTime);
if (outputs[OUT4_OUTPUT].isConnected()) {
Expand Down
25 changes: 8 additions & 17 deletions src/VCA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ struct VCA : Module {
configSwitch(MODE1_PARAM, 0.0f, 1.0f, 1.0f, "CH 1 Response", {"Exponential", "Linear"});
configSwitch(MODE2_PARAM, 0.0f, 1.0f, 1.0f, "CH 2 Response", {"Exponential", "Linear"});
//inputs
configInput(ENV1_INPUT, "CH 1 Response CV");
configInput(ENV2_INPUT, "CH 2 Response CV");
configInput(ENV1_INPUT, "CH 1 Gain CV");
configInput(ENV2_INPUT, "CH 2 Gain CV");
configInput(IN1_INPUT, "CH 1");
configInput(IN2_INPUT, "CH 2");
//Outputs
Expand All @@ -56,35 +56,26 @@ struct VCA : Module {
void process(const ProcessArgs &args) override {
//VCA 1

if(inputs[ENV1_INPUT].getVoltage()){
env1_mode_cv =! env1_mode_cv;
params[MODE1_PARAM].setValue(env1_mode_cv);
}

v1 = inputs[IN1_INPUT].getVoltage() * params[LEVEL1_PARAM].getValue();
if(inputs[ENV1_INPUT].isConnected()){
v1 = inputs[IN1_INPUT].getVoltage() * params[LEVEL1_PARAM].getValue();
//if(inputs[ENV1_INPUT].isConnected()){
if(params[MODE1_PARAM].getValue()==1){
v1 *= clamp(inputs[ENV1_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f);
}else{
v1 *= rescale(powf(expBase, clamp(inputs[ENV1_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f)), 1.0f, expBase, 0.0f, 1.0f);
}
}
//}

outputs[OUT1_OUTPUT].setVoltage(v1);
//VCA 2

if(inputs[ENV2_INPUT].getVoltage()){
env2_mode_cv =! env2_mode_cv;
params[MODE2_PARAM].setValue(env2_mode_cv);
}

v2 = inputs[IN2_INPUT].getVoltage() * params[LEVEL2_PARAM].getValue();
if(inputs[ENV2_INPUT].isConnected()){
//if(inputs[ENV2_INPUT].isConnected()){
if(params[MODE2_PARAM].getValue()){
v2 *= clamp(inputs[ENV2_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f);
}else{
v2 *= rescale(powf(expBase, clamp(inputs[ENV2_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f)), 1.0f, expBase, 0.0f, 1.0f);
}
}
//}
outputs[OUT2_OUTPUT].setVoltage(v2);
}

Expand Down

0 comments on commit 9ad1350

Please sign in to comment.