diff options
Diffstat (limited to 'midi.py')
-rw-r--r-- | midi.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -13,6 +13,8 @@ _outport = None _callbacks_on_press = dict() _callbacks_on_release = dict() +_debug = False + def midi_init(device_name="Launchpad Mini MIDI 1"): global _inport, _outport _inport = mido.open_input(device_name) @@ -21,10 +23,11 @@ def midi_init(device_name="Launchpad Mini MIDI 1"): _inport.callback = _callback def button_on(button, colour): - print(f"outport: {_outport}") + if _debug: print(f"outport: {_outport}") + if _outport: msg = _light_ctrl_msg.copy(note=button, velocity=colour) - print(f"sending {msg}") + if _debug: print(f"sending {msg}") _outport.send(msg) def button_off(button): |