Added A couple of todo

This commit is contained in:
Malphaet 2019-05-23 15:44:57 +02:00
parent 0bef104171
commit 48ec7c17c0
2 changed files with 24 additions and 17 deletions

View File

@ -124,22 +124,20 @@ class BasicActions(object):
if "-" in note:
nmin,nmax=note.split("-")
nmin,nmax=trunc(float(nmin)),trunc(float(nmax))
for i in range(nmin,nmax):
for trigger in (keys[int(i)]):
for i in range(nmin,nmax+1): # TODO : If there are exactly as many actions as the keys inside the dict, add one action per key
for trigger in (keys[int(i)]): # TODO : If the key doesn't exist, throw a # WARNING: instead of an error
trigger.addspecial(atype,conf[key])
else:
#print(note,trunc(float(note)))
for trigger in keys[trunc(float(note))]:
trigger.addspecial(atype,conf[key])
elif "-" in key: # There is a range of values to map
nmin,nmax=key.split("-")
nmin,nmax=trunc(float(nmin)),trunc(float(nmax))
for i in range(nmin,nmax):
for i in range(nmin,nmax+1):
if i not in keys:
keys[i]=[]
keys[i]+=self.makeAllKeys(i,conf[key],startkey=nmin,stopkey=nmax) #Do a different trigger for every ; and link to a different interface for every n/
else: # Nothing fancy
key_i=trunc(float(key))
if key_i not in keys:
keys[key_i]=[]
@ -292,12 +290,12 @@ class BasicMidiTrigger(object):
self.message=self.message.copy(**self.valuetype)
def sendmessage(self):
vprint("[Sent]: {}".format(self.message)) #TODO Add Verbose option
vprint("[Sent:({}.)]: {}".format(self.interface.name.split(":")[1][:12],self.message))
if self.toggle!=None:
self.toggle=not self.toggle
self.interface.send(self.message)
def addspecial(self,typ,val):
def addspecial(self,typ,val): #TODO : Offer a toggle between two differents messages, maybe a /switch
"""Affect a specific action (usually a condition) to the execution of the event"""
if typ == "val":
self.addvalfn(val)

View File

@ -10,18 +10,27 @@
[note_on]
1-99 = 1/on/1
1-99/toggle = 127/0
1 = 2/cc/1/45;2/cc/2/56;2/cc/3/87
3 = 2/cc/1/89;2/cc/2/13;2/cc/3/100
1 = 2/cc/1/45;2/cc/2/56;2/cc/3/87;2/cc/4/12;2/cc/5/50;2/cc/6/100
3 = 2/cc/1/89;2/cc/2/13;2/cc/3/100;2/cc/4/50;2/cc/5/80;2/cc/6/30
4 = 2/cc/7;2/cc/8;2/cc/9;2/cc/10;2/cc/11;2/cc/12
4/toggle = 0/127
[note_off]
#0-99 = 2/off/1
#0-99./toggle = 45/12
4 = 2/off/7
4/toggle = 127/0
[control_change]
16-19 = 2/cc/1
16-19/val = lambda x:min(randint(x,x+4),127)
20-23 = 2/cc/1
20-23/val = lambda x:min(60,x)
24-27 = 2/cc/1
24-27/val = lambda x:int((sin(18*x*3.14/127)*60+60))
16-18 = 2/cc/1
16-18/val = lambda x:min(randint(x,x+4),127)
19 = 2/cc/1;2/cc/2;2/cc/3;2/cc/4;2/cc/5;2/cc/6
20-22 = 2/cc/1
20-22/val = lambda x:min(60,x)
23 = 2/cc/1;2/cc/2;2/cc/3;2/cc/4;2/cc/5;2/cc/6
23/val=lambda x:min(60,x)
24-26 = 2/cc/1
24-26/val = lambda x:int((sin(13*x*3.14/127)*60+60))
27 = 2/cc/1;2/cc/2;2/cc/3;2/cc/4;2/cc/5;2/cc/6
27/val=lambda x:int((sin(13*x*3.14/127)*60+60))
62-63 = 2/cc/1-1;2/cc/2-2;2/cc/3-3
57 = 2/cc/13
61 = 2/cc/14