From 96fa61ed7a0f3e08b40f528e272fd73a7dbc9cf4 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sun, 21 Nov 2021 18:03:11 +0100 Subject: Fixed some bugs, added some midi buttons --- midi.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'midi.py') diff --git a/midi.py b/midi.py index 81b6703..7eca87e 100644 --- a/midi.py +++ b/midi.py @@ -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): -- cgit v1.2.3