]> git.sesse.net Git - nageru/commitdiff
Make the master light speed maximum inclusive instead of exclusive
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 19 Jan 2019 12:58:24 +0000 (13:58 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 19 Jan 2019 12:58:57 +0000 (13:58 +0100)
Less confusing when in an UI, and also doesn't require us to have
some spinners at max 127 and some at max 128 (save for pitch bend).

futatabi/behringer_cmd_pl1.midimapping
futatabi/futatabi_midi_mapping.proto
futatabi/midi_mapper.cpp

index edd5a05e5a63dbbefe9cc673bcdc2e1cd67543d8..52777b9498e37d82e8fd16823563727bdeaaba23 100644 (file)
@@ -43,7 +43,7 @@ preview_ready: { note_number: 27  velocity: 2 }
 master_speed: { controller_number: 128 }
 master_speed_light: { controller_number: 10 }
 master_speed_light_min: 1
-master_speed_light_max: 16
+master_speed_light_max: 15
 
 # Master speed lock is mapped to lock.
 toggle_lock: { note_number: 25 }
index 9714d2d672d4289f15de86729974f8ac934eaf64..8e6b3e9d32b78182e7e89c76a70eb60bcdb25348 100644 (file)
@@ -33,7 +33,7 @@ message MIDIMappingProto {
        optional int32 master_speed_bank = 35;
        optional MIDIControllerProto master_speed_light = 42;  // NOTE: Controller, not light.
        optional int32 master_speed_light_min = 43;
-       optional int32 master_speed_light_max = 44 [default=128];  // Exclusive.
+       optional int32 master_speed_light_max = 44 [default=127];  // Inclusive.
 
        // Buttons.
        optional MIDIButtonProto preview = 18;
index c675820fb3a40ef3a3244818a0fdb249a5460858..1d5d79e4ba85e9d9388f73bd94ecdc60d7840281 100644 (file)
@@ -251,7 +251,7 @@ void MIDIMapper::update_lights_lock_held()
                unsigned controller = mapping_proto->master_speed_light().controller_number();
                unsigned min = mapping_proto->master_speed_light_min();
                unsigned max = mapping_proto->master_speed_light_max();
-               int speed_light_value = lrintf((max - min - 1) * current_speed / 2.0f) + min;
+               int speed_light_value = lrintf((max - min) * current_speed / 2.0f) + min;
                active_lights[MIDIDevice::LightKey{MIDIDevice::LightKey::CONTROLLER, controller}] = speed_light_value;
        }