A lot a progress, nearing the completion of Midi sends
This commit is contained in:
parent
9e929a9e04
commit
32f4bc4e87
|
|
@ -56,7 +56,27 @@ class Action(BasicAction):
|
|||
else:
|
||||
self.sections[elt]={"*":self.config[elt]}
|
||||
|
||||
|
||||
|
||||
# Populate all the function calls with the data of the config sections
|
||||
for elt in self.sections: #Going in every section
|
||||
for group in self.sections[elt]: # Going in every sub-group
|
||||
conf,self.sections[elt][group]=self.sections[elt][group],{} #Replacing the links to the config with the real dict of links
|
||||
for key in conf: # Reading every mapping and liking it to the appropriate Trigger
|
||||
if "/" in key: # There is a condition to an action
|
||||
note,ctype=key.split("/")
|
||||
if "-" in note:
|
||||
nmin,nmax=note.split("-")
|
||||
for i in range(nmin,nmax):
|
||||
conf.sections[elt][group][i].condition(ctype,conf[key])
|
||||
else:
|
||||
conf.sections[elt][group][note].condition(ctype,conf[key])
|
||||
elif "-" in key: # There is a range of values to map
|
||||
nmin,nmax=key.split("-")
|
||||
for i in range(nmin,nmax):
|
||||
conf.sections[elt][group][i]=MidiTrigger() #Do a different trigger for every ; and link to a different interface for every n/
|
||||
else: # Nothing fancy
|
||||
self.sections[elt][group][key]=MidiTrigger()
|
||||
|
||||
def format(self,command,number,page):
|
||||
"Format a match to call the correct action"
|
||||
try:
|
||||
|
|
@ -70,5 +90,19 @@ class Action(BasicAction):
|
|||
# Try a predefined action
|
||||
pass
|
||||
|
||||
class MidiTrigger(object):
|
||||
"""A midi trigger, will do a specific action when called"""
|
||||
def __init__(self,interface,message):
|
||||
self.output=interface
|
||||
self.message=message
|
||||
self.cond=False
|
||||
def __call__(self,val):
|
||||
"""Execute the call if the condition is true"""
|
||||
pass
|
||||
|
||||
def condition(self,ctype,funct):
|
||||
"""Affect a specific action (usually a condition) to the execution of the event"""
|
||||
pass
|
||||
|
||||
class MatchError(Exception):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
[interface]
|
||||
input="Scarlett i6"
|
||||
output="Scarlett i6"
|
||||
loopback="Akai Mix"
|
||||
output1="Scarlett i6"
|
||||
output2="Akai Mix"
|
||||
inputchanel = 1
|
||||
outputchannel = 1
|
||||
loopbackchannel = 1
|
||||
mapping = GrandMA2
|
||||
outputchannel1 = 1
|
||||
outputchannel2 = 1
|
||||
mapping = GrandMA2 # Will fetch GrandMA2.py in the mappings
|
||||
|
||||
#Patching faders
|
||||
[set/1] #Patches layer 1 patch:2 would patch layer 2 and so on
|
||||
1 = cc/10 #Send (midi) control change (10) with value mapped to the fader (1) value (fader 1 => cc 10)
|
||||
5-50 = cc/11 #Map the faders 5-50 to the control change 11-45 (Straight patch)
|
||||
56 = note/152 #Map fader 56 to note 152
|
||||
57 = val/lambda f: x>50 #Function choosing the value to send instead of a simple mapping
|
||||
1 = 1/cc/10 #Send (midi) control change (10) with value mapped to the fader (1) value (fader 1 => cc 10) on output 1
|
||||
5-50 = 1/cc/11 #Map the faders 5-50 to the control change 11-45 (Straight patch) on output 1
|
||||
57-67 = 1/cc/12-32 # Will map linearly 57 to 12; 58 to 14 etc on output 1
|
||||
56 = 2/note/152 #Map fader 56 to note 152 on output 2
|
||||
56/cond = lambda x: x==50 # Function choosing conditions on the value to send
|
||||
|
||||
[fire] #No layer specified
|
||||
13 = note/10
|
||||
15 = cc/44/127 #Send control change with value 127
|
||||
13 = 1/note/10
|
||||
15 = 1/cc/44/127 #Send control change with value 127
|
||||
17-27 = cc/45/127 # Send control change 45-55 with value 127
|
||||
38 = cc/65/124;cc/79/100;note/25 (Stack the action to link to)
|
||||
38 = 1/cc/65/124;2/cc/79/100;note/25 (Stack the action to link to)
|
||||
|
|
|
|||
Loading…
Reference in New Issue