Tweak initial generic-midi sync/smoothing
authorRobin Gareus <robin@gareus.org>
Sat, 4 May 2019 21:33:27 +0000 (23:33 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 5 May 2019 00:49:53 +0000 (02:49 +0200)
"last_controllable_value" is using midi value range (0..127).
It is used to compare received midi-value with the actual controllable
for non-motorized surfaces, and this change allows the first
event to already be in_sync.

Previously the first MIDI-event was usually ignored (because
last_controllable_value was out of bounds or didn't match the 0..127
range.

libs/surfaces/generic_midi/midicontrollable.cc

index ee08bd70a966ffeccd026c20ca89051de57671aa..b06a39d7a206985c1fd720f0a902663ab01d1aef 100644 (file)
@@ -136,7 +136,7 @@ MIDIControllable::set_controllable (boost::shared_ptr<PBD::Controllable> c)
 
        if (c) {
                _controllable = c;
-               last_controllable_value = c->get_value();
+               last_controllable_value = control_to_midi (c->get_value());
        } else {
                _controllable.reset();
                last_controllable_value = 0.0f; // is there a better value?