aboutsummaryrefslogtreecommitdiffstats
path: root/src/jalv_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jalv_qt.cpp')
-rw-r--r--src/jalv_qt.cpp9
1 files 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 <stdio.h>
-#include <math.h>
+#include <algorithm>
+#include <cmath>
+#include <cstdio>
#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;
}