| 123 | */ |
| 124 | template <class TParamQuantity = ParamQuantity> |
| 125 | TParamQuantity* configParam(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::string unit = "", float displayBase = 0.f, float displayMultiplier = 1.f, float displayOffset = 0.f) { |
| 126 | assert(paramId < (int) params.size() && paramId < (int) paramQuantities.size()); |
| 127 | if (paramQuantities[paramId]) |
| 128 | delete paramQuantities[paramId]; |
| 129 | |
| 130 | TParamQuantity* q = new TParamQuantity; |
| 131 | q->ParamQuantity::module = this; |
| 132 | q->ParamQuantity::paramId = paramId; |
| 133 | q->ParamQuantity::minValue = minValue; |
| 134 | q->ParamQuantity::maxValue = maxValue; |
| 135 | q->ParamQuantity::defaultValue = defaultValue; |
| 136 | q->ParamQuantity::name = name; |
| 137 | q->ParamQuantity::unit = unit; |
| 138 | q->ParamQuantity::displayBase = displayBase; |
| 139 | q->ParamQuantity::displayMultiplier = displayMultiplier; |
| 140 | q->ParamQuantity::displayOffset = displayOffset; |
| 141 | paramQuantities[paramId] = q; |
| 142 | |
| 143 | Param* p = ¶ms[paramId]; |
| 144 | p->value = q->getDefaultValue(); |
| 145 | return q; |
| 146 | } |
| 147 | |
| 148 | /** Helper for creating a SwitchQuantity and setting its label strings. |
| 149 | See ParamQuantity and SwitchQuantity for documentation of arguments. |
no test coverage detected