From 5a93aed6b76e447a7944b6df33a103fba565866f Mon Sep 17 00:00:00 2001 From: Beffroi Date: Tue, 9 Jul 2019 10:00:22 +0200 Subject: [PATCH] Added most of the Yamaha mapping Working is forbidding more tests, but most of it should work --- mapping/Yamaha.py | 25 +++++++++++++++++-------- mapping/yamaha.txt | 14 +++++++++++--- midiRebind.py | 4 +++- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/mapping/Yamaha.py b/mapping/Yamaha.py index 4171ea6..965f865 100644 --- a/mapping/Yamaha.py +++ b/mapping/Yamaha.py @@ -2,7 +2,7 @@ from mapping.base import BasicMessageParse,BasicActions,MatchError,BasicMidiInte import mido import re,configparser -commandlist={0:"DCA",55:"IN",84:"MIX",101:"MATRICE",115:"MASTER",82:"MASTER2",51:"PAGE",53:"MUTE"} +commandlist={127:"DCA",55:"IN",84:"MIX",101:"MATRICE",115:"MASTER",336:"MASTER2",122:"PAGE",53:"MUTE",893:"CUE"} # Doc says 11 is go_off, test says otherwise #A MessageParse object MUST be included in the file, the rest is implementation Specific @@ -26,7 +26,7 @@ class MessageParse(BasicMessageParse): raise MatchError("Message is not sysex") try: self.typebit=message[5] - self.command=message[6] + self.command=message[6]+message[5]*127 self.data=message[7:] return self except: @@ -49,25 +49,34 @@ class Actions(BasicActions): # 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(int(match.command)) action=commandlist[int(match.command)] id,value="1","1" page=0 # Yamaha consoles don't use pages in a way that is relevant to us #"DCA",55:"IN",84:"MIX",101:"MATRICE",115:"MASTER",82:"MASTER2",51:"PAGE" - if action in ["DCA","IN","MIX","MATRICE","MASTER","MASTER2"]: + if action in ["IN","MIX","MATRICE","MASTER","MASTER2"]: data=match.data #print(data[6:8],makeInt(data[6:8])) - value=makeInt(data[6:8]) + value=makeInt(data[7:]) id=int(data[3]) # Just mapped from 0 to 127 + elif action == "DCA": + pass elif action=="CUE": - pass + data=match.data + value=int(data[8])*127 + id=int(data[3]) elif action=="MUTE": - pass + data=match.data + id=int(data[3]) + value=int(data[8])*127 elif action=="PAGE": - pass + data=match.data + id=int(data[3]) + value=int(data[8]) else: return try: - print(action,value) + # print(action,id,value,data) listact=self.findAction(action,id,page) for act in listact: act(value) diff --git a/mapping/yamaha.txt b/mapping/yamaha.txt index 8fc403f..1d9f191 100644 --- a/mapping/yamaha.txt +++ b/mapping/yamaha.txt @@ -10,17 +10,25 @@ MIX MATRICE 8:100 f0 43 10 3e 19 01 00 65 00 00 00 07 00 00 00 07 7f f7 MASTER -1 f0 43 10 3e 19 01 00 73 00 00 00 01 00 00 00 07 7f f7 +1L f0 43 10 3e 19 01 00 73 00 00 00 00 00 00 00 07 7f f7 +1R f0 43 10 3e 19 01 00 73 00 00 00 01 00 00 00 07 7f f7 2 f0 43 10 3e 19 01 02 52 00 13 00 00 00 00 00 07 7f f7 -MUTE +MUTE IN OFF f0 43 10 3e 19 01 00 35 00 00 00 00 00 00 00 00 01 f7 ON f0 43 10 3e 19 01 00 35 00 00 00 00 00 00 00 00 01 f7 +MUTE DCA -CUE + +MUTE MASTER + +MUTE MASTER2 + + +CUE IN ? ON f0 43 10 3e 19 01 02 09 00 00 00 00 00 00 00 00 01 f7 f0 43 10 3e 19 01 07 04 00 00 00 00 00 00 00 00 01 f7 OFF f0 43 10 3e 19 01 02 09 00 00 00 00 00 00 00 00 00 f7 diff --git a/midiRebind.py b/midiRebind.py index 01f9ff8..7861006 100755 --- a/midiRebind.py +++ b/midiRebind.py @@ -39,8 +39,10 @@ if __name__ == '__main__': res=Acts(match) except Module.MatchError: pass + except KeyError: + vprint("[Error] Command in {} could not be recognised".format(msg)) except: - print("[Unexpected error@midibind.py] {}".format(sys.exc_info())) + print("[Unexpected error@midibind.py] {}".format(sys.exc_info())) except ImportError: print("[Error] Module {} doesn't exist".format(interpath)) except KeyboardInterrupt: