Skip to content

Commit

Permalink
Fix GOMA initialisation
Browse files Browse the repository at this point in the history
* fix higher CPU on GOMA II
* SlewLFO add description to capacitor expander
  • Loading branch information
hemmer committed Sep 13, 2024
1 parent c577bfe commit 7e06d54
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ This repo contains VCV ports of Black Noise Modular Eurorack modules. See: https

License: GPL-3.0-or-later

## Screenshots

<img src="./Screenshot.png" style="max-width: 100%;">


## Differences with hardware

We have tried to make the VCV implementations as authentic as possible, however there are some minor changes that have been made (either for usuability or to bring modules in line with VCV rack conventions and standards).
Expand All @@ -25,3 +20,6 @@ SlewLFO

More information and resources for the hardware versions can be found at https://github.com/BlackNoiseModular/Eurorack

## Screenshots

<img src="./Screenshot.png" style="max-width: 100%;">
42 changes: 27 additions & 15 deletions src/GomaII.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,35 @@ struct GomaII : Module {
updateCounter.setDivision(32);
}

std::vector<int> getPolyphonyStatus(int expanderPolyphonyChannels) {
std::vector<int> result;
void onReset(const ResetEvent& e) override {
Module::onReset(e);

// gain knobs default values depend on mode
updateKnobSettingsForMode();

for (int m = 0; m < 4; m++) {
params[GAIN_EXT_PARAM + m].setValue(getParamQuantity(GAIN_EXT_PARAM + m)->defaultValue);
}
}

void updateKnobSettingsForMode() {
for (int m = 0; m < 4; m++) {
getParamQuantity(GAIN_EXT_PARAM + m)->displayOffset = params[MODE_EXT_PARAM + m].getValue() ? 0.f : -100.f;
getParamQuantity(GAIN_EXT_PARAM + m)->displayMultiplier = params[MODE_EXT_PARAM + m].getValue() ? 100.f : 200.f;
getParamQuantity(GAIN_EXT_PARAM + m)->defaultValue = params[MODE_EXT_PARAM + m].getValue() ? 0.f : 0.5f;
}
}

int polyphonyStatus[4] = {1, 1, 1, 1};
void updatePolyphonyStatus(int expanderPolyphonyChannels) {

for (int i = 0; i < 4; i++) {
if (i == 0) {
result.push_back(std::max({1, inputs[EXT_INPUT + i].getChannels(), expanderPolyphonyChannels}));
polyphonyStatus[i] = std::max({1, inputs[EXT_INPUT + i].getChannels(), expanderPolyphonyChannels});
}
else {
result.push_back(std::max(1, inputs[EXT_INPUT + i].getChannels()));
polyphonyStatus[i] = std::max(1, inputs[EXT_INPUT + i].getChannels());
}

}

for (int i = 0; i < 4; i++) {
Expand All @@ -96,30 +115,23 @@ struct GomaII : Module {
}

for (int j = i + 1; j < 4; j++) {
result[j] = result[i] = std::max(result[i], result[j]);
polyphonyStatus[j] = polyphonyStatus[i] = std::max(polyphonyStatus[i], polyphonyStatus[j]);

if (outputs[EXT_OUTPUT + j].isConnected()) {
break;
}
}
}

return result;
}

void process(const ProcessArgs& args) override {


// only need to do rarely, but update gain label based on whether we are in attenuator mode or attenuverter mode
if (updateCounter.process()) {
for (int m = 0; m < 4; m++) {
getParamQuantity(GAIN_EXT_PARAM + m)->displayOffset = params[MODE_EXT_PARAM + m].getValue() ? 0.f : -100.f;
getParamQuantity(GAIN_EXT_PARAM + m)->displayMultiplier = params[MODE_EXT_PARAM + m].getValue() ? 100.f : 200.f;
getParamQuantity(GAIN_EXT_PARAM + m)->defaultValue = params[MODE_EXT_PARAM + m].getValue() ? 0.f : 0.5f;
}
updateKnobSettingsForMode();
}


const float_4 normalledVoltageValue = (normalledVoltage == NORMALLED_5V) ? 5.f : 10.f;

float_4 activeSum[4] = {};
Expand All @@ -135,7 +147,7 @@ struct GomaII : Module {
}
numExpanderPolyphonyChannels = leftExpanderData->numActivePolyphonyChannels;
}
const std::vector<int> polyphonyStatus = getPolyphonyStatus(numExpanderPolyphonyChannels);
updatePolyphonyStatus(numExpanderPolyphonyChannels);

// loop over the four mixer channels (ext, ch1, ch2, ch3)
for (int m = 0; m < 4; m++) {
Expand Down
3 changes: 2 additions & 1 deletion src/SlewLFO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ struct SlewLFO : Module {
configParam(FALL_PARAM, 0.f, 1.f, 0.5f, "Fall");
configSwitch(MODE_PARAM, 0.f, 1.f, 0.f, "Mode", {"LFO", "Slew"});
configSwitch(RATE_PARAM, 0.f, 1.f, 0.f, "Rate", {"Slow", "Fast"});
configSwitch(CAPACITOR_PARAM, CAP_NONE, CAP_SLOOOOW, CAP_NONE, "Capacitor", {"None", "10uF (slow)", "100uF (sloooow)"});
auto capacitorExpander = configSwitch(CAPACITOR_PARAM, CAP_NONE, CAP_SLOOOOW, CAP_NONE, "Capacitor Expander", {"None", "Slow (~10uF)", "Sloooow (~100uF)"});
capacitorExpander->description = "The capacitor expander allows the user to add their own capacitor to modify the slew rate.";
configInput(RISE_INPUT, "Rise CV");
configInput(FALL_INPUT, "Fall CV");
configInput(IN_INPUT, "In");
Expand Down

0 comments on commit 7e06d54

Please sign in to comment.