From 3f6b62637eda0218a14aeb0afe46385df0e2b659 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Thu, 27 Apr 2023 04:40:24 -0400 Subject: [PATCH] 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. --- include/engine/Module.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/engine/Module.hpp b/include/engine/Module.hpp index 23d9b39f..6f6107e9 100644 --- a/include/engine/Module.hpp +++ b/include/engine/Module.hpp @@ -152,7 +152,9 @@ struct Module { template TSwitchQuantity* configSwitch(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::vector labels = {}) { TSwitchQuantity* sq = configParam(paramId, minValue, maxValue, defaultValue, name); - sq->labels = labels; + sq->ParamQuantity::snapEnabled = true; + sq->ParamQuantity::smoothEnabled = false; + sq->SwitchQuantity::labels = labels; return sq; } @@ -162,7 +164,9 @@ struct Module { template TSwitchQuantity* configButton(int paramId, std::string name = "") { TSwitchQuantity* sq = configParam(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; }