From 64a1d2ed4aa5d102343e9fe7d105ec20d79e0560 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 6 May 2019 20:47:41 +0200 Subject: [PATCH] A few bugfixes --- mapping/base.py | 11 +++++++---- mapping/midi.py | 2 +- patch/midi.ini | 18 +++++------------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/mapping/base.py b/mapping/base.py index 5573682..3ecd4b6 100644 --- a/mapping/base.py +++ b/mapping/base.py @@ -169,7 +169,7 @@ class BasicActions(object): try: return [BasicMidiTrigger(self.interface.interfaceOut(int(interfaceout)),midiaction,self.findNote(key,startkey,stopkey,note),intensity)] except (KeyError): - print("[WARNING] Can't find interface {} for note {} action {}, legal interfaces are {}".format(interfaceout,note,action,[i for i in self.interface.output.keys()])) + print("[WARNING] Can't find interface {} for note {} action {}, legal interfaces are {}".format(interfaceout,note,action,[i for i in self.interface.outputs.keys()])) return [] #This choice is not necessary the best, but I figure it's easier that forcing the config to be perfect except ValueError: print("[WARNING] Incorrect values given to the midi message {}".format(action)) @@ -258,15 +258,18 @@ class BasicMidiTrigger(object): # if not cond(val): # return #A condition isn't met, returning change=self.value + if self.valuefn: change=self.valuefn(val) - if self.toggle!=None: + elif self.toggle!=None: if self.toggle: change=self.valtrue else: change=self.valfalse - if change!=self.value and change != None and change !="": - self.value=change + else: + change=val + if change != None and change !="": + self.value=val self.valuetype[list(self.valuetype)[0]]=change self.message=self.message.copy(**self.valuetype) diff --git a/mapping/midi.py b/mapping/midi.py index 90b3c6f..9934b22 100644 --- a/mapping/midi.py +++ b/mapping/midi.py @@ -50,7 +50,7 @@ class Actions(BasicActions): try: listact=self.findAction(match.type,match.note,"*") for act in listact: - act(value) + act(match.value) except: # No action linked to the trigger pass diff --git a/patch/midi.ini b/patch/midi.ini index 5c39ca4..1fd66e9 100644 --- a/patch/midi.ini +++ b/patch/midi.ini @@ -1,24 +1,16 @@ [interface] input=MIDI Mix MIDI 1 - output1=KMidimon - output2=MIDI Mix MIDI 1 + output1=MIDI Mix MIDI 1 + output2=Midi Through Port-0 inputchanel = 1 outputchannel1 = 1 outputchannel2 = 1 mapping = midi [note_on] - 0-99 = 2/note/0 + 0-99 = 1/note/0 0-99/toggle = 127/0 - 0-50 = 1/cc/11 - 57-67 = 1/cc/12-32 - 56 = 1/note/127 - 56/val = lambda x: min(x,50)*2 + 0-100 = 2/note/0 [control_change] - 13 = 1/note/10 - 15 = 1/cc/44/127 - 17-27 = cc/45/127 - 29-37 = cc/46-46/127 - 38 = 1/cc/65/124;2/cc/79/100;note/25 - 38/toggle = 0/127 + 1-100 = 2/cc/0