Skip to content

Commit

Permalink
Fix faderbank range issue #184, deserialize range before deserializin…
Browse files Browse the repository at this point in the history
…g params
  • Loading branch information
Dewb committed Oct 3, 2023
1 parent f5efa81 commit 6a17a27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/faderbank/FaderbankModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FaderbankModule::FaderbankModule()

for (unsigned i = 0; i < NUM_FADERS; i++)
{
configParam(i, -10.0, 10.0, 0.0, rack::string::f("Fader %d", i + 1), " V");
configParam(i, 0.0, 10.0, 0.0, rack::string::f("Fader %d", i + 1), " V");
}

resetConfig();
Expand Down Expand Up @@ -191,3 +191,13 @@ void FaderbankModule::dataFromJson(json_t* rootJ)
}
}
}

void FaderbankModule::fromJson(json_t* rootJ)
{
// deserialize data before params, so voltage range option is set correctly
json_t* dataJ = json_object_get(rootJ, "data");
if (dataJ)
dataFromJson(dataJ);

Module::fromJson(rootJ);
}
3 changes: 3 additions & 0 deletions src/faderbank/FaderbankModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ struct FaderbankModule : rack::Module

json_t* dataToJson() override;
void dataFromJson(json_t* rootJ) override;
// override fromJson to deserialize data before params
void fromJson(json_t* rootJ) override;


rack::midi::InputQueue midiInput;
std::map<uint16_t, uint8_t> inputMap;
Expand Down

0 comments on commit 6a17a27

Please sign in to comment.