diff --git a/mapping/GrandMA2.py b/mapping/GrandMA2.py index 18b7dec..a0c557e 100644 --- a/mapping/GrandMA2.py +++ b/mapping/GrandMA2.py @@ -8,36 +8,38 @@ class MessageParse(BasicMessageParse): """Parsing of a gma SyEx message this parser is used once and will return a different Action object every time it is called""" def __init__(self): - #super(Parse, self).__init__() #The init here is irrelevant - #The data is converted from hex to decimal for readability and usability + #The init here is irrelevant + #The data is converted from hex to decimal for readability and usability by mido self._mapping = {"deviceid":127, #Will usually be 127 for ALL "commandformat":127, #1 is general lighting format, 2 is moving light format and 127 is ALL "command":None, #from 1 to 7 plus 11 (off) "data":None #The actual data } - self.pattern=re.compile("240 127 (?P\d+) 0?2 (?P\d+) (?P\d+) (?P[\d+ ]+) 247") + self.pattern=re.compile("240 127 (?P\d+) 0?2 (?P\d+) (?P\d+) (?P[\d+ ]+) 247") #The regex that will map the SysEx message self._commandlist=commandlist def __call__(self,message): - "Parse the message and depending on the type, return a different action" + "Parse the message and return either a match or raise an error" match=re.match(self.pattern,message) if match: - # Matched return match else: raise MatchError - return - class Action(BasicAction): """The list of action to perform when a message is read""" - def __init__(self): - pass + def __init__(self,config): + """Parse the config and ready all return actions""" + self.config=config + # Load config + # Parse config & check sanity + # Create all the call setups - def __call__(self,config): + def __call__(self,match): + """Launch the action depending on the config, the config format is supposed to be as canon as possible + but since the actual implementation is custom made... go wild ?""" + # Try a predefined action pass class MatchError(Exception): pass - #def __init__(self): - # super(MatchError, self).__init__() diff --git a/patch/default.ini b/patch/default.ini index d62918c..1277840 100644 --- a/patch/default.ini +++ b/patch/default.ini @@ -1,8 +1,10 @@ [interface] input="Scarlett i6" output="Scarlett i6" + loopback="Akai Mix" inputchanel = 1 outputchannel = 1 + loopbackchannel = 1 mapping = GrandMA2 #Patching faders diff --git a/test.py b/test.py index 0ca93e2..8248a9d 100644 --- a/test.py +++ b/test.py @@ -72,6 +72,7 @@ class mappingTest(minitest.simpleTestUnit): self.addSuccess() else: self.addFailure("Incorrect fields: "+inc[:-1]) + def testParse(self,message): try: parsed=self.parser(message)