tidy up how midi_input is set/accessed from plugins, nicer complaining when the shader gadget plugins arent present, and feedback plugin now takes most of its config (which notes to light up) by reading the midi config

This commit is contained in:
Tristan Rowley
2020-01-19 15:00:13 +00:00
parent 6996bef707
commit 72b7c292a6
4 changed files with 39 additions and 15 deletions

View File

@@ -10,6 +10,7 @@ class MidiInput(object):
self.display = display
self.actions = actions
self.data = data
self.data.midi_input = self
self.midi_mappings = data.midi_mappings
self.midi_device = None
self.midi_feedback_device = None
@@ -166,3 +167,12 @@ class MidiInput(object):
if self.midi_output.supports_midi_feedback(self.data.midi_device_name):
self.root.after(self.midi_delay*5, self.refresh_midi_feedback)
def find_binding_for_action(self, action):
for bind,a in self.midi_mappings.items():
#print("looped over %s : %s " % (bind,a))
for (b,c) in a.items():
if action in c:
#print ("find_binding_for_action(%s) got %s" % (action, bind))
return bind