Added Quickframe and a pseudo config
This commit is contained in:
parent
86f9cd83a0
commit
f595f898fb
3
TODO.md
3
TODO.md
|
|
@ -1,5 +1,4 @@
|
|||
# Big list of big stuff to do
|
||||
* Move all projects/subprojects to src/
|
||||
# Main Tasks
|
||||
* Make all tests
|
||||
* Clean up the code and the TODO
|
||||
* Make the code more readable
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ class midiPageHandler(object):
|
|||
if (self._changedbasevalues[linecol[0]][linecol[1]]&statusId):
|
||||
self._changedbasevalues[linecol[0]][linecol[1]]-=statusId
|
||||
|
||||
def hasStatus(self,statusId):
|
||||
def hasStatus(self,linecol,statusId):
|
||||
"Check if a status is present"
|
||||
if (self._changedbasevalues[linecol[0]][linecol[1]]&statusId):
|
||||
return True
|
||||
|
|
@ -385,8 +385,8 @@ class pulseRackController(object):
|
|||
self.realByName={i:j for i,j in zip(self.lineNames,ranges.values())}
|
||||
# dprint(self.returnByName,self.realByName)
|
||||
_ALL_MESSAGE_TYPES=["STATUS","LAYERINP","TAKE","TAKEALL","LOADMM","QUICKF"]
|
||||
self._command_cols=["Black1","Black2","Freeze1","Freeze2",None,None,None,"TakeAll"]
|
||||
self._command_colors=[("Inactive","Selected"),("Inactive","Selected"),"Active","Active",None,None,None,"Live"]
|
||||
self._command_cols=["Black1","Black2","Freeze1","Freeze2",None,None,"Quickframe","TakeAll"]
|
||||
self._command_colors=[("Inactive","Selected"),("Inactive","Selected"),"Active","Active",None,None,"Active","Live"]
|
||||
self.commandPos={name:(self.returnByName["Commands"],i) for name,i in zip(self._command_cols,range(8))}
|
||||
self.returnInterface=returnInterface
|
||||
self.output=None
|
||||
|
|
@ -448,15 +448,17 @@ class pulseRackController(object):
|
|||
self.receiveFreeze(match)
|
||||
elif command=="STATUS":
|
||||
self.receiveStatus(match)
|
||||
elif command=="QUICKF":
|
||||
self.receiveQuickframe(match)
|
||||
|
||||
@doublepress
|
||||
def takeAllProtect(self):
|
||||
"TakaAll, double-press protected"
|
||||
"""TakaAll, double-press protected"""
|
||||
self.returnInterface._IOInterface.toExternalProgram("TAKEALL")
|
||||
#print("Taking...")
|
||||
|
||||
def specialPress(self,line,col):
|
||||
"Press on the special line"
|
||||
"""Press on the special line"""
|
||||
# print("SPECIAL ON PROGRESS",line,self._command_cols[col])
|
||||
command=self._command_cols[col]
|
||||
if command=="Black1":
|
||||
|
|
@ -471,7 +473,9 @@ class pulseRackController(object):
|
|||
elif command=="Freeze1":
|
||||
self.returnInterface._IOInterface.toExternalProgram("FREEZELAYER",0,1) # Action is none, so it toggles, maybe
|
||||
elif command=="Freeze2":
|
||||
self.returnInterface._IOInterface.toExternalProgram("FREEZELAYER",1,1)
|
||||
self.returnInterface._IOInterface.toExternalProgram("FREEZELAYER",0,2)
|
||||
elif command=="Quickframe":
|
||||
self.returnInterface._IOInterface.toExternalProgram("QUICKFRAME",0)
|
||||
|
||||
def sendLayerInp(self,screen,liveprev,layer,idinput):
|
||||
"""Send a message to the pulse: Layer input change
|
||||
|
|
@ -524,10 +528,12 @@ class pulseRackController(object):
|
|||
"Receive a freeze input"
|
||||
layer,screen,action=match.group("postargs").split(",")
|
||||
# print(self.commandPos["Freeze"+str(int(layer)+1)])
|
||||
if action=="1": # Freezing ?
|
||||
self.returnInterface.addStatus(self.commandPos["Freeze"+str(int(layer)+1)],"Live") # Probably, maybe layer+1
|
||||
if layer != '0':
|
||||
return None # Only for layer 0
|
||||
if action == "1": # Freezing ?
|
||||
self.returnInterface.addStatus(self.commandPos["Freeze"+str(int(screen))],"Live") # Probably, maybe layer+1
|
||||
else:
|
||||
self.returnInterface.removeStatus(self.commandPos["Freeze"+str(int(layer)+1)],"Live")
|
||||
self.returnInterface.removeStatus(self.commandPos["Freeze"+str(int(screen))],"Live")
|
||||
self.returnInterface.applyChanges()
|
||||
self.returnInterface.applyColors()
|
||||
|
||||
|
|
@ -544,6 +550,16 @@ class pulseRackController(object):
|
|||
self.returnInterface.applyChanges()
|
||||
self.returnInterface.applyColors()
|
||||
|
||||
def receiveQuickframe(self,match):
|
||||
"A quickframe (all) is received, update the controller"
|
||||
src,status=match.group("postargs").split(",")
|
||||
dprint("A quickframe is received by the handler Layer:{},status:{}".format(src,status))
|
||||
if status=='1':
|
||||
self.returnInterface.addStatus(self.commandPos["Quickframe"],"Live")
|
||||
else:
|
||||
self.returnInterface.removeStatus(self.commandPos["Quickframe"],"Live")
|
||||
self.returnInterface.applyChanges()
|
||||
self.returnInterface.applyColors()
|
||||
|
||||
def sendMemoryChange(self,memory,liveprev):
|
||||
"""Adjust the color and info of a memory press (take or preview)
|
||||
|
|
@ -630,7 +646,8 @@ class AkaiAPCMini(midiPageHandler):
|
|||
self.lightnote(note,val)
|
||||
|
||||
def lightcolor(self,col,row,color):
|
||||
self.light(col,row,val=_COLORS[color])
|
||||
print("Lighting {col} {row} with {color}".format(col=col,row=row,color=color))
|
||||
self.light(col,row,val=self.colors[color])
|
||||
|
||||
def light(self,col,row,val=1):
|
||||
self.lightnote(self.findit(col,row),val)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ def printl(label=""):
|
|||
|
||||
eprint=printl("[mPH:ERROR]")
|
||||
dprint,ddprint,iprint,wprint=nopeF,nopeF,nopeF,nopeF
|
||||
# bindings.dprint, bindings.ddprint, bindings.iprint= nopeF, nopeF, nopeF
|
||||
bindings.dprint, bindings.ddprint, bindings.iprint= nopeF, nopeF, nopeF
|
||||
|
||||
if _VERBOSE>=1:
|
||||
wprint=printl("[mPH:WARNING]")
|
||||
|
|
@ -52,21 +52,22 @@ class pulseLink(object):
|
|||
def message(self):
|
||||
pass
|
||||
|
||||
def _onload(self):
|
||||
def _onload(self,config):
|
||||
"Send a reset colors"
|
||||
import time
|
||||
try:
|
||||
HOSTS=[["127.0.0.1",3000]] # Test server
|
||||
#HOSTS=[["127.0.0.1",3000]] # Test server
|
||||
patch = config["interface"]
|
||||
HOSTS = [[patch["module1_ip"], int(patch["module1_port"])]]
|
||||
# HOSTS=[["192.168.0.140",10500]] # Test server
|
||||
|
||||
# The socket remote controller
|
||||
controllerPulse1= bindings.analogController(*HOSTS[0])
|
||||
|
||||
# Adding the midi interface to the controller
|
||||
handler.addInterfaceOut(self.interfaceOut(1))
|
||||
time.sleep(0.2)
|
||||
time.sleep(1)
|
||||
# The pulse module, bound to 3 lines
|
||||
modulePulse1=handler.addModule(midiPageHandler.pulseRackController, [0, 1, 2, 4])
|
||||
modulePulse1=handler.addModule(midiPageHandler.pulseRackController, [0, 1, 3, 4])
|
||||
|
||||
# The IO interface between the pulse and the controller, one IO is necessary per auxilliary application
|
||||
IOInterface= midiPageHandler.IOInterfacePulse(handler, modulePulse1, controllerPulse1)
|
||||
|
|
@ -107,6 +108,7 @@ class MidiInterface(BasicMidiInterface):
|
|||
|
||||
def __init__(self,configfile):
|
||||
super(MidiInterface,self).__init__(configfile)
|
||||
_onload(self)
|
||||
|
||||
_onload(self,self.config)
|
||||
self.functionlist["pagepress"]=pagepress
|
||||
self.functionlist["quitpress"]=quitpress
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
outputchannel1 = 1
|
||||
#outputchannel2 = 1
|
||||
mapping = panapulse
|
||||
module1 = pulse
|
||||
module1_ip = 192.168.0.140
|
||||
; module1_ip = 127.0.0.1
|
||||
module1_port = 10500
|
||||
|
||||
[note_on]
|
||||
0-88/funct = pagepress()
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@
|
|||
outputchannel1 = 1
|
||||
#outputchannel2 = 1
|
||||
mapping = panapulse
|
||||
|
||||
module1 = pulse
|
||||
module1_ip = 192.168.0.140
|
||||
; module1_ip = 127.0.0.1
|
||||
module1_port = 10500
|
||||
[note_on]
|
||||
0-88/funct = pagepress()
|
||||
89/funct = quitpress()
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 54312e99eabfe10ac5032962e5259d8f4321f410
|
||||
Subproject commit f4b1972d195d9043fda505d1b48ff8b604361ee1
|
||||
Loading…
Reference in New Issue