This commit is contained in:
sam 2020-04-23 16:00:37 +02:00
parent c169e11409
commit 98f039b2ee
5 changed files with 58 additions and 68 deletions

View File

@ -170,7 +170,7 @@ def curved(value):
def cc(midichannel, ccnumber, value, mididest):
#print "cc()"
print("Jamidi Sending locally Midi channel", midichannel, "cc", ccnumber, "value", value, "to", mididest)
print("CC for local Midi channel", midichannel, "cc", ccnumber, "value", value, "to", mididest)
# Apply CC routing ?
if len(MidiRules["cc2cc"]) > 0 :
@ -188,10 +188,6 @@ def cc(midichannel, ccnumber, value, mididest):
midi3.MidiMsg((176 + MidiRules["cc2cc"][counter]["chanOUT"], MidiRules["cc2cc"][counter]["ccOUT"], curved(MidiVal)), MidiRules["cc2cc"][counter]["mididest"])
#else:
print("Jamidi Sending locally Midi channel", midichannel, "cc", ccnumber, "value", value, "to", mididest)
#if mididest == "BCR2000 Port 1":
midi3.MidiMsg([CONTROLLER_CHANGE+midichannel-1, ccnumber, value], mididest)
@ -281,21 +277,19 @@ def on_message(ws, message):
print("")
print(message)
print("Incoming ws message",message)
if len(message) > 200:
message = message[:200]+'..'
oscpath = message.split(" ")
if debug > 0:
print(GetTime(),"Main got from WS", client['id'], "said :", message, "splitted in an oscpath :", oscpath)
else:
print(GetTime(),"Main got WS Client", client['id'], "said :", message)
wscommand = oscpath[0].split("/")
device = wscommand[1]
command = wscommand[2]
# debug
if debug > 0:
print("wscommand :",wscommand)
print("for device", device,"command :", command)
# noarg
if len(oscpath) == 1:
@ -303,20 +297,15 @@ def on_message(ws, message):
#print "noargs command"
# CC : /device/cc/2 127
elif wscommand[2] == "cc":
elif command == "cc":
ccvr=int(wscommand[3]) #cc variable
ccvl=int(oscpath[1]) #cc value
if debug > 0:
print("ccvr=%d/ccvl=%d"%(ccvr,ccvl))
if wscommand[1] == "ocs2":
#cc(Confs[wscommand[1]][0]["midichan"], ccvr, ccvl, Confs[wscommand[1]][0]["mididevice"])
crtvalueOCS2[ccvr]=ccvl
else:
#cc(Confs[wscommand[1]][0]["midichan"], ccvr, ccvl, Confs[wscommand[1]][0]["mididevice"])
crtvalueMMO3[ccvr]=ccvl
print("device", device,"ccvr=%d/ccvl=%d"%(ccvr,ccvl))
for mididevice in midi3.findJamDevices(wscommand[1]):
cc(Confs[wscommand[1]][0]["midichan"], ccvr, ccvl, mididevice)
for mididevice in midi3.findJamDevices(device):
cc(Confs[device][0]["midichan"], ccvr, ccvl, mididevice)
'''
# CC : /device/cc/2 127
@ -339,22 +328,21 @@ def on_message(ws, message):
'''
# RESET : /device/reset 1
elif wscommand[2] == "reset":
if wscommand[1] == "ocs2":
elif command == "reset":
if device == "ocs2":
reset("ocs2")
else:
reset("mmo3")
# NOTEON : /device/noteon note velocity
elif wscommand[2] == "noteon":
for mididevice in midi3.findJamDevices(wscommand[1]):
elif command == "noteon":
for mididevice in midi3.findJamDevices(device):
midi3.NoteOn(int(oscpath[1]), int(oscpath[2]), mididevice)
# NOTEOFF /device/noteoff note
elif wscommand[2] == "noteoff":
for mididevice in midi3.findJamDevices(wscommand[1]):
elif command == "noteoff":
for mididevice in midi3.findJamDevices(device):
midi3.NoteOff(int(oscpath[1]), mididevice)
@ -402,8 +390,6 @@ try:
except Exception:
traceback.print_exc()
except KeyboardInterrupt:
pass
# Gently stop on CTRL C

View File

@ -21,7 +21,7 @@
}
],
"xkkia" :
"xrkia" :
[
{
"_comment": "Server is xrkia.org",
@ -48,7 +48,8 @@
"_comment": "OCS-2 device parameters",
"type": "mididevice",
"mididevice": "UM-ONE:UM-ONE MIDI 1 20:0",
"midichan" : 2
"midichan" : 2,
"xname" : "ocs2"
}
],
@ -57,25 +58,28 @@
"_comment": "MMO-3 device parameters",
"type": "mididevice",
"mididevice": "UM-ONE:UM-ONE MIDI 1 20:0",
"midichan" : 1
"midichan" : 1,
"xname" : "mmo3"
}
],
"ocs2b": [
"ocs2bcr": [
{
"_comment": "OCS-2 control with BCR2000",
"type": "mididevice",
"mididevice": "BCR2000 Port 1",
"midichan" : 2
"midichan" : 2,
"xname" : "ocs2"
}
],
"mmo3b": [
"mmo3bcr": [
{
"_comment": "MMO-3 control with BCR2000",
"type": "mididevice",
"mididevice": "BCR2000 Port 1",
"midichan" : 1
"midichan" : 1,
"xname" : "mmo3"
}
],
@ -84,7 +88,8 @@
"_comment": "Launchpad mini device parameters",
"type": "mididevice",
"mididevice": "Launchpad Mini",
"midichan" : 0
"midichan" : 0,
"xname" : "launchpad"
}
],
@ -94,7 +99,8 @@
"_comment": "Client : default midi device",
"type": "mididevice",
"mididevice": "BCR2000 Port 1",
"midichan" : 3
"midichan" : 3,
"xname" : "default"
}
]

View File

@ -517,13 +517,13 @@ def MidiMsg(midimsg, mididest):
desterror = -1
print("midi3 got midimsg", midimsg, "for", mididest)
print("jamidi3 got midimsg", midimsg, "for", mididest)
for port in range(len(OutDevice)):
# To mididest
if midiname[port].find(mididest) != -1:
if debug>0:
print("midi 3 sending to name", midiname[port], "port", port, ":", midimsg)
print("jamidi 3 sending to name", midiname[port], "port", port, ":", midimsg)
midiport[port].send_message(midimsg)
desterror = 0
@ -566,8 +566,8 @@ def findJamName(mididevice, midichan):
#print(v[0]["mididevice"],v[0]["midichan"], type(v[0]["midichan"]))
if (v[0]["mididevice"] == mididevice) and (v[0]["midichan"] == midichan):
print("Incoming event from", k)
return k
print("Incoming event from", k, "xname", v[0]["xname"])
return v[0]["xname"]
return "None"
@ -579,11 +579,11 @@ def findJamDevices(name):
for (k, v) in Confs.items():
if v[0]["type"] == "mididevice":
#print(k, name,k.find(name))
if k.find(name) != -1:
#print(k, name,v[0]["xname"])
if v[0]["xname"] == name:
#print(v[0]["mididevice"])
devices.append(v[0]["mididevice"])
#print(devices)
# print(devices)
return devices

View File

@ -339,8 +339,6 @@ try:
except Exception:
traceback.print_exc()
except KeyboardInterrupt:
pass
# Gently stop on CTRL C

View File

@ -27,7 +27,7 @@
"Specials": [
{
"_comment": "Pas implementé encore dans nozoidUI",
"_comment": "Pas implementé encore dans Jamidi",
"name": "autotempo",
"songname": "song1",
"chanIN" : 16,