FP8: limit fader range
authorRobin Gareus <robin@gareus.org>
Sun, 16 Apr 2017 21:48:06 +0000 (23:48 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 16 Apr 2017 21:48:06 +0000 (23:48 +0200)
In case of VCA masters or otherwise the value can exceed the max
+6dB and internal_to_interface() returns a value > 1.0 which cannot
be represented on the physical fader (MIDI &0x7f wraps)

libs/surfaces/faderport8/fp8_strip.cc

index 3bedf0e85c03d01d8d777b27050379e2c1325bd4..a0a3b8245714e396dee6948fd55bc618d4f5390e 100644 (file)
@@ -360,6 +360,7 @@ FP8Strip::notify_fader_changed ()
        float val = 0;
        if (ac) {
                val = ac->internal_to_interface (ac->get_value()) * 16368.f; /* 16 * 1023 */
+               val = std::max (0.f, std::min (1.f, val));
        }
        unsigned short mv = lrintf (val);
        if (mv == _last_fader) {