diff --git a/mod/host.py b/mod/host.py index 6f92bbb5b..b1c9d0d50 100644 --- a/mod/host.py +++ b/mod/host.py @@ -4913,6 +4913,20 @@ def address(self, instance, portsymbol, actuator_uri, label, minimum, maximum, v # MIDI learn is not saved until a MIDI controller is moved. # So we need special casing for unlearn. if actuator_uri == kMidiUnlearnURI: + old_addressing = pluginData['addressings'].pop(portsymbol, None) + if old_addressing is not None: + self.addressings.remove(old_addressing) + self.pedalboard_modified = True + + if portsymbol == ":bypass": + pluginData['bypassCC'] = (-1, -1) + else: + pluginData['midiCCs'][portsymbol] = (-1, -1, 0.0, 1.0) + + # Clients other than the one that unlearned have no other signal that + # the mapping is gone; -1:-1 is the same form mod-host reports. + self.msg_callback("midi_map %s %s -1 -1 0.0 1.0" % (instance, portsymbol)) + self.send_modified("midi_unmap %d %s" % (instance_id, portsymbol), callback, datatype='boolean') return @@ -4934,6 +4948,11 @@ def address(self, instance, portsymbol, actuator_uri, label, minimum, maximum, v else: pluginData['midiCCs'][portsymbol] = (-1, -1, 0.0, 1.0) + # Clients other than the one that removed the addressing have no + # other signal that the mapping is gone; -1:-1 is the same form + # mod-host reports. + self.msg_callback("midi_map %s %s -1 -1 0.0 1.0" % (instance, portsymbol)) + else: # Changing ranges without changing MIDI CC if -1 in (channel, controller):