diff --git a/README.md b/README.md index ed9ae10..55a393b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ # midiRebind -Get/send midi commands to a GrandMA but can be configured to bind any custom SysEx message +Was originally designed to get/send midi commands to a GrandMA but can be configured to bind any custom SysEx or midi (or whatever actually) message + To do so add a custom patch (or use a currently defined one, but chances are patches made for one SysEx won't work on another) and add a parser in the mapping directory # Depends -* Mostly mido (pip install mido) for the midi binding and blessings for the testing (pip install blessings) -* test.py depends on the submodule minitest witch also depends on blessings but is not necessary +* Mostly mido (pip install mido) for the midi binding and rtmidi (sudo apt install python-rtmidi) +* test.py depends on the submodule minitest witch also depends on blessings (pip install blessings). test.py is not core of the program +* This program is python3 compliant (as long as you install the python3 dependencies instead (pip3 install mido and install python3-rtmidi)) # Config Syntax diff --git a/mapping/GrandMA2.py b/mapping/GrandMA2.py index 4fb81b7..72e4938 100644 --- a/mapping/GrandMA2.py +++ b/mapping/GrandMA2.py @@ -26,15 +26,18 @@ class MessageParse(BasicMessageParse): else: raise MatchError -# This funtion is MANDATORY, it makes the link between MessageParse and Action -def CallAction(match,ActionObj): - "Make the link between the regex and the action" - pass # An Action object MUST be included in the file. -# Interitance and method override can be used, but aren't needed here -# Action(config) -Action=BasicAction +class Action(BasicAction): + """The list of action to perform when a message is read""" + def __init__(self, interface): + super(Action, self).__init__(interface) + + # This funtion is MANDATORY, it makes the link between MessageParse and Action + def __call__(self,match): + "Make the link between the regex and the action" + print(match) + # Same as above, import BasicMidiInterface as MidiInterface could be used instead # MidiInterface(config) diff --git a/mapping/base.py b/mapping/base.py index 716856e..5f276c5 100644 --- a/mapping/base.py +++ b/mapping/base.py @@ -44,6 +44,7 @@ class BasicMidiInterface(object): print("[ERROR] Impossible to open output {} (available are {})".format(name,mido.get_output_names())) o=None return o + class BasicMessageParse(object): """Classic System Specific Midi Message as Hex (BasicSyHexParse). Uses one method, parseMidi to parse the message and return a BasicMapping object with the mapping of the message inside"""