Skip to content

Commit

Permalink
Fixed JSON export
Browse files Browse the repository at this point in the history
  • Loading branch information
codygeary authored Sep 27, 2024
1 parent efa510c commit 4991a13
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/Arrange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ struct Arrange : Module {
}
}

void onReset(const ResetEvent& e) override {
// Reset all parameters
Module::onReset(e);
void onReset(const ResetEvent& e) override {
// Reset all parameters
Module::onReset(e);
for (int stage = 0; stage < 128; stage++) {
for (int channel = 0; channel < 7; channel++) {
outputValues[stage][channel] = 0.0f; // Reset each element to 0.0f
Expand Down Expand Up @@ -415,7 +415,7 @@ struct Arrange : Module {
} else if (activeInputChannel[i] > -1){
// Now we compute which channel we need to grab
int diffBetween = i - activeInputChannel[i];
int currentChannelMax = inputChannels[activeInputChannel[i]] ;
int currentChannelMax = inputChannels[activeInputChannel[i]] ;
if (currentChannelMax - diffBetween > 0) { //If we are before the last poly channel
inputVal = inputs[CHAN_1_INPUT + activeInputChannel[i]].getPolyVoltage(diffBetween);
}
Expand Down Expand Up @@ -473,9 +473,11 @@ struct Arrange : Module {
if (enablePolyOut) {
// Update tooltips to reflect polyphonic output
configOutput(CHAN_1_OUTPUT, "Poly Channel 1");
outputs[CHAN_1_OUTPUT].setChannels(7); // Set the number of channels to 7
} else {
// Revert tooltips to reflect monophonic output
configOutput(CHAN_1_OUTPUT, "Channel 1");
outputs[CHAN_1_OUTPUT].setChannels(1); // Set the number of channels to 1
}

// Update the previous state to the current state
Expand All @@ -484,15 +486,11 @@ struct Arrange : Module {

// Process poly-OUTPUTS
if (enablePolyOut) {
// Set the polyphonic voltage for the first output (A_OUTPUT)
outputs[CHAN_1_OUTPUT].setChannels(7); // Set the number of channels to 5
// Set the polyphonic voltage for the first output
for ( int part = 1; part < 7; part++) {
outputs[CHAN_1_OUTPUT].setVoltage(outputs[CHAN_1_OUTPUT + part].getVoltage(), part); // Set voltage for the polyphonic channels
}
} else {
outputs[CHAN_1_OUTPUT].setChannels(1); // Set the number of channels to 1
}

}
}//void process
};

Expand Down Expand Up @@ -544,7 +542,6 @@ struct ProgressDisplay : TransparentWidget {
}
};


struct ArrangeWidget : ModuleWidget {
ArrangeWidget(Arrange* module) {
setModule(module);
Expand Down Expand Up @@ -734,11 +731,10 @@ struct ArrangeWidget : ModuleWidget {

// Add the item to the context menu
PolyOutEnabledItem* polyOutItem = new PolyOutEnabledItem();
polyOutItem->text = "Enable Polyphonic Output to Channel A"; // Customize this text
polyOutItem->text = "Enable Polyphonic Output to Channel 1"; // Customize this text
polyOutItem->arrangeModule = arrangeModule;
menu->addChild(polyOutItem);
}


};

Expand Down
19 changes: 19 additions & 0 deletions src/StepWave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ struct StepWave : Module {
json_t* dataToJson() override {
json_t* rootJ = json_object();

// Save the state of linkLatched
json_object_set_new(rootJ, "linkLatched", json_boolean(linkLatched));

// Save the state of trackGateActive
json_object_set_new(rootJ, "trackLatched", json_boolean(trackLatched));

// Save the state of stageShapeCV
json_object_set_new(rootJ, "stageShapeCV", json_boolean(stageShapeCV));

Expand All @@ -227,6 +233,19 @@ struct StepWave : Module {
}

void dataFromJson(json_t* rootJ) override {

// Load the state of linkLatched
json_t* linkLatchedJ = json_object_get(rootJ, "linkLatched");
if (linkLatchedJ) {
linkLatched = json_is_true(linkLatchedJ);
}

// Load the state of trackLatched
json_t* trackLatchedJ = json_object_get(rootJ, "trackLatched");
if (trackLatchedJ) {
trackLatched = json_is_true(trackLatchedJ);
}

// Load the state of stageShapeCV
json_t* stageShapeCVJ = json_object_get(rootJ, "stageShapeCV");
if (stageShapeCVJ) {
Expand Down

0 comments on commit 4991a13

Please sign in to comment.