Browse Source

Enable `ParamQuantity::snapEnabled` and disable `smoothEnabled` in `Module::configSwitch()` and `configButton()`.

This is already done in `ParamWidget::initParamQuantity()`, but Module should not depend on the UI to configure its ParamQuantities.
tags/v2.4.0
Andrew Belt 1 year ago
parent
commit
3f6b62637e
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      include/engine/Module.hpp

+ 6
- 2
include/engine/Module.hpp View File

@@ -152,7 +152,9 @@ struct Module {
template <class TSwitchQuantity = SwitchQuantity> template <class TSwitchQuantity = SwitchQuantity>
TSwitchQuantity* configSwitch(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::vector<std::string> labels = {}) { 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); TSwitchQuantity* sq = configParam<TSwitchQuantity>(paramId, minValue, maxValue, defaultValue, name);
sq->labels = labels;
sq->ParamQuantity::snapEnabled = true;
sq->ParamQuantity::smoothEnabled = false;
sq->SwitchQuantity::labels = labels;
return sq; return sq;
} }


@@ -162,7 +164,9 @@ struct Module {
template <class TSwitchQuantity = SwitchQuantity> template <class TSwitchQuantity = SwitchQuantity>
TSwitchQuantity* configButton(int paramId, std::string name = "") { TSwitchQuantity* configButton(int paramId, std::string name = "") {
TSwitchQuantity* sq = configParam<TSwitchQuantity>(paramId, 0.f, 1.f, 0.f, name); TSwitchQuantity* sq = configParam<TSwitchQuantity>(paramId, 0.f, 1.f, 0.f, name);
sq->randomizeEnabled = false;
sq->ParamQuantity::snapEnabled = true;
sq->ParamQuantity::smoothEnabled = false;
sq->ParamQuantity::randomizeEnabled = false;
return sq; return sq;
} }




Loading…
Cancel
Save