Browse Source

Add configSwitch(), which is a quicker way to configure parameters with SwitchQuantitys.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
92f777d184
2 changed files with 7 additions and 3 deletions
  1. +7
    -0
      include/engine/Module.hpp
  2. +0
    -3
      include/engine/ParamQuantity.hpp

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

@@ -121,6 +121,13 @@ struct Module {
return q;
}

template <class TSwitchQuantity = SwitchQuantity>
TSwitchQuantity* configSwitch(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::vector<std::string> labels = {}) {
TSwitchQuantity* sq = configParam<TSwitchQuantity>(paramId, minValue, maxValue, defaultValue, name);
sq->labels = labels;
return sq;
}

template <class TPortInfo = PortInfo>
TPortInfo* configInput(int portId, std::string name = "") {
assert(portId < (int) inputs.size() && portId < (int) inputInfos.size());


+ 0
- 3
include/engine/ParamQuantity.hpp View File

@@ -75,9 +75,6 @@ struct ParamQuantity : Quantity {
struct SwitchQuantity : ParamQuantity {
std::vector<std::string> labels;

void setLabels(const std::vector<std::string>& labels) {
this->labels = labels;
}
std::string getDisplayValueString() override;
void setDisplayValueString(std::string s) override;
};


Loading…
Cancel
Save