prefer floor() over round(), this avoids "-0"
authorRobin Gareus <robin@gareus.org>
Sat, 23 Sep 2017 16:59:39 +0000 (18:59 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 23 Sep 2017 16:59:39 +0000 (18:59 +0200)
GUI interface values are always in the range 0..1 so there's no abiguity
with trunc()

libs/ardour/parameter_descriptor.cc

index 7ba89140e97f7bcb7cff3b4c732016bbe9db3394..0bc81fa064f74096cab77a5d4d1861cf8c1d3d1d 100644 (file)
@@ -384,7 +384,7 @@ ParameterDescriptor::from_interface (float val) const
                                 * e.g. 5 integers 0,1,2,3,4 are mapped to a fader
                                 * [0.0 .. 0.2 | 0.2 .. 0.4 | 0.4 .. 0.6 | 0.6 .. 0.8 | 0.8 .. 1.0]
                                 */
-                               val =  round (lower + val * (1.f + upper - lower) - .5f);
+                               val = floor (lower + val * (1.f + upper - lower));
                        } else if (rangesteps > 1) {
                                /* similar to above, but for float controls */
                                val = floor (val * (rangesteps - 1.f)) / (rangesteps - 1.f); // XXX