Started to work on the function interface
This commit is contained in:
parent
5a93aed6b7
commit
5556905785
|
|
@ -25,9 +25,13 @@ To do so add a custom patch (or use a currently defined one, but chances are pat
|
|||
* Advanced usage: Can add logic to the notes. NB: they must be defined first
|
||||
* 56/cond = lambda x: x==50 # Function choosing conditions on the value to send
|
||||
* 57/toggle = 0/127: Toggle the val between 127 and 0 every time the note is received
|
||||
* 68/func = functionMappedInTheMappingInterface(note,intensity,parameters)
|
||||
|
||||
# Adding another mapping interface
|
||||
* TODO: Explain it better than just "look at the ones I made"
|
||||
|
||||
# Improvements
|
||||
* Add Fix values
|
||||
* Better note / cc / pc notation
|
||||
* Add Fade (in ms) from one value to another
|
||||
* Have a way to know last value for the note/cc (the last one sent/received)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/python3
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
from dearpygui.demo import show_demo
|
||||
|
||||
show_demo()
|
||||
dpg.start_dearpygui()
|
||||
|
|
@ -118,7 +118,7 @@ class BasicActions(object):
|
|||
def makeTriggers(self,conf):
|
||||
"Take a section of a config and put all triggers in a dict"
|
||||
keys={}
|
||||
for key in conf: # Reading every mapping and liking it to the appropriate Trigger
|
||||
for key in conf: # Reading every mapping and linking it to the appropriate Trigger
|
||||
if "/" in key: # There is a condition to an action
|
||||
note,atype=key.split("/")
|
||||
if "-" in note:
|
||||
|
|
@ -302,6 +302,8 @@ class BasicMidiTrigger(object):
|
|||
elif typ == "toggle":
|
||||
valt,valf=val.split("/")
|
||||
self.addstate(int(valt),int(valf))
|
||||
elif typ == "funct":
|
||||
self.addspecfn(val)
|
||||
|
||||
def addvalfn(self,fn):
|
||||
"Add a special function to calculate the value"
|
||||
|
|
@ -311,6 +313,13 @@ class BasicMidiTrigger(object):
|
|||
except:
|
||||
print("[ERROR] Cant evaluate funtion {}".format(fn))
|
||||
|
||||
def addspecfn(self,val):
|
||||
"Add a funtion (defined in the mapping) with eventual arguments specified in the mapping"
|
||||
try:
|
||||
self.funct=mapping.__get_attribute__(val)
|
||||
except:
|
||||
print("[ERROR] Can't evaluate function {}".function(fn))
|
||||
|
||||
def addstate(self,valtrue,valfalse):
|
||||
"The message will now send two state values intead"
|
||||
self.toggle=True
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/python3
|
||||
|
||||
|
||||
import pyautogui
|
||||
Loading…
Reference in New Issue