prefer floor() over round(), this avoids "-0"

GUI interface values are always in the range 0..1 so there's no abiguity
with trunc()
This commit is contained in:
Robin Gareus 2017-09-23 18:59:39 +02:00
parent d50c738203
commit a9c8a25fc4

View 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