+
+ /**
+ * Answers the slider value, converted to the corresponding 'true' value by
+ * applying scaling
+ *
+ * @return
+ */
+ float getSliderValue()
+ {
+ int value = slider.getValue();
+ float f = (value - sliderOffset) / sliderScaleFactor;
+
+ /*
+ * avoid rounding errors at min/max of range
+ */
+ if (value == slider.getMaximum())
+ {
+ f = max;
+ }
+ else if (value == slider.getMinimum())
+ {
+ f = min;
+ }
+ return f;
+ }
+
+ /**
+ * Sets the slider value, converted from the corresponding 'true' value by
+ * applying scaling
+ *
+ * @param f
+ */
+ void setSliderValue(float f)
+ {
+ float v = f * sliderScaleFactor + sliderOffset;
+ slider.setValue((int) v);
+ }