add a clittols mode
This commit is contained in:
parent
66ba694bdc
commit
9aef301068
Binary file not shown.
@ -83,6 +83,11 @@ ccontinue = mido.Message(type ="continue")
|
||||
reset = mido.Message(type ="reset")
|
||||
songpos = mido.Message(type ="songpos")
|
||||
|
||||
nocolor = 64
|
||||
green = 16
|
||||
yellow = 127
|
||||
red = 3
|
||||
|
||||
#mode = "maxwell"
|
||||
|
||||
'''
|
||||
@ -463,6 +468,21 @@ def NoteOn(note, color, mididest, midichannel=0):
|
||||
elif mididest == "pads" and midiname[port].find("Launchpad") > -1:
|
||||
midiport[port].send_message([NOTE_ON+midichannel, note, color])
|
||||
|
||||
if mode == "clitools":
|
||||
x,y = PadIndex(note)
|
||||
print("Y :",y)
|
||||
if 0< y < 3:
|
||||
ClsCli1()
|
||||
if 2< y < 5:
|
||||
ClsCli2()
|
||||
if 4< y < 7:
|
||||
ClsCli3()
|
||||
if 6< y < 9:
|
||||
ClsCli4()
|
||||
|
||||
PadNoteOnXY(x,y,red)
|
||||
|
||||
|
||||
|
||||
|
||||
def NoteOff(note, mididest, midichannel=0):
|
||||
@ -480,8 +500,8 @@ def NoteOff(note, mididest, midichannel=0):
|
||||
midiport[port].send_message([NOTE_OFF, note, 0])
|
||||
|
||||
|
||||
elif mididest == "pads" and midiname[port].find("Launchpad") > -1:
|
||||
midiport[port].send_message([NOTE_OFF, note, 0])
|
||||
#elif mididest == "pads" and midiname[port].find("Launchpad") > -1:
|
||||
# midiport[port].send_message([NOTE_OFF, note, 0])
|
||||
|
||||
|
||||
# Generic call back : new msg forwarded to queue
|
||||
@ -696,8 +716,8 @@ def InConfig():
|
||||
#midinputs[port].set_callback(AddQueue(name))
|
||||
#genericnumber += 1
|
||||
InDevice[InObject.counter-1].rtmidi.set_callback(AddQueue(name,port))
|
||||
if name.find("Launch") > -1:
|
||||
Cls()
|
||||
#if name.find("Launch") > -1:
|
||||
# Cls()
|
||||
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
@ -908,6 +928,39 @@ def AllColorPad(color):
|
||||
PadTopOn(topled+1,color)
|
||||
#midiport[port].send_message([CONTROLLER_CHANGE, topled, color])
|
||||
|
||||
def ClsCli1():
|
||||
|
||||
for x in range(8):
|
||||
PadNoteOnXY(x,1,58)
|
||||
PadNoteOnXY(x,2,58)
|
||||
|
||||
def ClsCli2():
|
||||
|
||||
for x in range(8):
|
||||
PadNoteOnXY(x,3,yellow)
|
||||
PadNoteOnXY(x,4,yellow)
|
||||
|
||||
def ClsCli3():
|
||||
|
||||
for x in range(8):
|
||||
PadNoteOnXY(x,5,58)
|
||||
PadNoteOnXY(x,6,58)
|
||||
|
||||
def ClsCli4():
|
||||
|
||||
for x in range(8):
|
||||
PadNoteOnXY(x,7,yellow)
|
||||
PadNoteOnXY(x,8,yellow)
|
||||
|
||||
|
||||
def ClsCli():
|
||||
|
||||
ClsCli1()
|
||||
ClsCli2()
|
||||
ClsCli3()
|
||||
ClsCli4()
|
||||
|
||||
|
||||
def ClsMatrix():
|
||||
for led in range(0,64,1):
|
||||
PadNoteOff(led)
|
||||
@ -921,16 +974,12 @@ def ClsRight():
|
||||
for rightled in range(8):
|
||||
PadRightOff(rightled+1)
|
||||
|
||||
|
||||
|
||||
def Cls():
|
||||
|
||||
ClsMatrix()
|
||||
ClsTop()
|
||||
ClsRight()
|
||||
|
||||
|
||||
|
||||
def Start():
|
||||
|
||||
#ClsPad(port)
|
||||
@ -945,13 +994,12 @@ def Start():
|
||||
PadNoteOn(color-64, color)
|
||||
#print("color", color)
|
||||
time.sleep(0.5)
|
||||
AllColorPad(127)
|
||||
time.sleep(0.5)
|
||||
Cls()
|
||||
#time.sleep(0.3)
|
||||
#UpdateDisplay()
|
||||
|
||||
|
||||
if mode == "clitools":
|
||||
ClsCli()
|
||||
for y in range(0,8,2):
|
||||
PadNoteOnXY(1,y-1,red)
|
||||
|
||||
def listdevice(number):
|
||||
|
||||
|
@ -97,6 +97,7 @@ argsparser.add_argument("-p","--port",help="Port of the Redis server ",default="
|
||||
argsparser.add_argument("-o","--oscip",help="IP address of the OSC server to forward midi events.",default="127.0.0.1",type=str)
|
||||
argsparser.add_argument("-q","--oscport",help="Port of the OSC server ",default="9000",type=str)
|
||||
argsparser.add_argument('-link',help="Enable Ableton Link (disabled by default)", dest='link', action='store_true')
|
||||
argsparser.add_argument("-m","--mode",help="Mode choice : simplex, clitools",default="clitools",type=str)
|
||||
argsparser.set_defaults(link=False)
|
||||
|
||||
args = argsparser.parse_args()
|
||||
@ -105,6 +106,7 @@ redisPORT = args.port
|
||||
midix.oscIP = args.oscip
|
||||
midix.oscPORT = int(args.oscport)
|
||||
midix.debug = args.verbose
|
||||
midix.mode = args.mode
|
||||
|
||||
# with Ableton Link
|
||||
if args.link == True:
|
||||
@ -151,9 +153,6 @@ def Osc():
|
||||
#time.sleep(0.0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user