From b1fb68fd3c6ee3535ca066b271150a9cdd54c975 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 22 Jul 2018 18:18:10 +0200 Subject: Fix stepped logarithmic controls in generic Qt UIs --- src/jalv_qt.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp index 38340b2..72f9f0a 100644 --- a/src/jalv_qt.cpp +++ b/src/jalv_qt.cpp @@ -14,8 +14,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include -#include +#include +#include +#include #include "jalv_internal.h" @@ -417,7 +418,7 @@ Control::Control(PortContainer portContainer, QWidget* parent) LilvNode* stepsNode = lilv_port_get(plugin, lilvPort, nodes->pprops_rangeSteps); if (lilv_node_is_int(stepsNode)) { - steps = lilv_node_as_int(stepsNode); + steps = std::max(lilv_node_as_int(stepsNode), 2); } else { steps = DIAL_STEPS; } @@ -563,7 +564,7 @@ Control::getValue() } else if (isInteger) { return dial->value(); } else if (isLogarithmic) { - return min * pow(max / min, (float)dial->value() / steps); + return min * pow(max / min, (float)dial->value() / (steps - 1)); } else { return (float)dial->value() / steps; } -- cgit v1.2.1