Browse Source

Add assertions to Module helpers.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
31d99cbdcd
3 changed files with 3 additions and 2 deletions
  1. +1
    -0
      include/engine/Module.hpp
  2. +0
    -2
      src/app/Toolbar.cpp
  3. +2
    -0
      src/engine/Module.cpp

+ 1
- 0
include/engine/Module.hpp View File

@@ -84,6 +84,7 @@ struct Module {

template <class TParamQuantity = ParamQuantity>
void configParam(int paramId, float minValue, float maxValue, float defaultValue, std::string label = "", std::string unit = "", float displayBase = 0.f, float displayMultiplier = 1.f, float displayOffset = 0.f) {
assert(paramId < (int) params.size() && paramId < (int) paramQuantities.size());
if (paramQuantities[paramId])
delete paramQuantities[paramId];



+ 0
- 2
src/app/Toolbar.cpp View File

@@ -479,8 +479,6 @@ struct LogInItem : ui::MenuItem {


struct ManageItem : ui::MenuItem {
ManageItem() {
}
void onAction(const event::Action &e) override {
std::thread t([&]() {
system::openBrowser("https://vcvrack.com/plugins.html");


+ 2
- 0
src/engine/Module.cpp View File

@@ -16,6 +16,8 @@ Module::~Module() {
}

void Module::config(int numParams, int numInputs, int numOutputs, int numLights) {
// This method should only be called once.
assert(params.empty() && inputs.empty() && outputs.empty() && lights.empty() && paramQuantities.empty());
params.resize(numParams);
inputs.resize(numInputs);
outputs.resize(numOutputs);


Loading…
Cancel
Save