added sync devices with close name ocs2, ocs2a,...
This commit is contained in:
parent
4b63fceadc
commit
c169e11409
4 changed files with 57 additions and 43 deletions
|
|
@ -150,8 +150,8 @@ def MidinProcess(inqueue, portname):
|
|||
MidiVel = msg[2]
|
||||
print("NOTE ON :", MidiNote, 'velocity :', MidiVel, "Channel", MidiChannel)
|
||||
#NoteOn(msg[1],msg[2],mididest)
|
||||
print("Midi in process send /"+findJamDevice(portname, MidiChannel)+"/noteon "+str(msg[1])+" "+str(msg[2]))
|
||||
wssend("/"+findJamDevice(portname, MidiChannel)+"/noteon "+str(msg[1])+" "+str(msg[2]))
|
||||
print("Midi in process send /"+findJamName(portname, MidiChannel)+"/noteon "+str(msg[1])+" "+str(msg[2]))
|
||||
wssend("/"+findJamName(portname, MidiChannel)+"/noteon "+str(msg[1])+" "+str(msg[2]))
|
||||
|
||||
'''
|
||||
# Sampler mode : note <63 launch snare.wav / note > 62 kick.wav
|
||||
|
|
@ -182,18 +182,18 @@ def MidinProcess(inqueue, portname):
|
|||
|
||||
print("NOTE OFF :", MidiNote, 'velocity :', MidiVel, "Channel", MidiChannel)
|
||||
#NoteOff(msg[1],msg[2], mididest)
|
||||
print("Midi in process send /"+findJamDevice(portname, MidiChannel)+"/noteoff "+str(msg[1]))
|
||||
wssend("/"+findJamDevice(portname, MidiChannel)+"/noteoff "+str(msg[1]))
|
||||
print("Midi in process send /"+findJamName(portname, MidiChannel)+"/noteoff "+str(msg[1]))
|
||||
wssend("/"+findJamName(portname, MidiChannel)+"/noteoff "+str(msg[1]))
|
||||
|
||||
|
||||
# # CC on all Midi Channels
|
||||
if CONTROLLER_CHANGE -1 < msg[0] < 192:
|
||||
|
||||
MidiChannel = msg[0]-175
|
||||
#findJamDevice(portname, MidiChannel)
|
||||
print("channel", MidiChannel, " ",findJamDevice(portname, MidiChannel), " CC :", msg[1], msg[2])
|
||||
print("Midi in process send /"+findJamDevice(portname, MidiChannel)+"/cc/"+str(msg[1])+" "+str(msg[2])+" to WS")
|
||||
wssend("/"+findJamDevice(portname, MidiChannel)+"/cc/"+str(msg[1])+" "+str(msg[2]))
|
||||
#findJamName(portname, MidiChannel)
|
||||
print("channel", MidiChannel, " ",findJamName(portname, MidiChannel), " CC :", msg[1], msg[2])
|
||||
print("Midi in process send /"+findJamName(portname, MidiChannel)+"/cc/"+str(msg[1])+" "+str(msg[2])+" to WS")
|
||||
wssend("/"+findJamName(portname, MidiChannel)+"/cc/"+str(msg[1])+" "+str(msg[2]))
|
||||
|
||||
|
||||
'''
|
||||
|
|
@ -233,20 +233,10 @@ def NoteOn(note,color, mididest):
|
|||
midiport[port].send_message([NOTE_ON, note, color])
|
||||
|
||||
# To All
|
||||
elif mididest == "all" and midiname[port].find(mididest) != 0 and midiname[port].find(BhorealMidiName) != 0 and midiname[port].find(LaunchMidiName) != 0:
|
||||
elif mididest == "all" and midiname[port].find(mididest) != 0:
|
||||
midiport[port].send_message([NOTE_ON, note, color])
|
||||
|
||||
'''
|
||||
# To Launchpad, if present.
|
||||
elif mididest == "launchpad" and midiname[port].find(LaunchMidiName) == 0:
|
||||
launchpad.PadNoteOn(note%64,color)
|
||||
|
||||
# To Bhoreal, if present.
|
||||
elif mididest == "bhoreal" and midiname[port].find(BhorealMidiName) == 0:
|
||||
gstt.BhorLeds[note%64]=color
|
||||
midiport[port].send_message([NOTE_ON, note%64, color])
|
||||
#bhorosc.sendosc("/bhoreal", [note%64 , 0])
|
||||
'''
|
||||
|
||||
|
||||
def NoteOff(note, mididest):
|
||||
|
|
@ -260,21 +250,9 @@ def NoteOff(note, mididest):
|
|||
midiport[port].send_message([NOTE_OFF, note, 0])
|
||||
|
||||
# To All
|
||||
elif mididest == "all" and midiname[port].find(mididest) == -1 and midiname[port].find(BhorealMidiName) == -1 and midiname[port].find(LaunchMidiName) == -1:
|
||||
elif mididest == "all" and midiname[port].find(mididest) == -1:
|
||||
midiport[port].send_message([NOTE_OFF, note, 0])
|
||||
|
||||
'''
|
||||
# To Launchpad, if present.
|
||||
elif mididest == "launchpad" and midiname[port].find(LaunchMidiName) == 0:
|
||||
launchpad.PadNoteOff(note%64)
|
||||
|
||||
# To Bhoreal, if present.
|
||||
elif mididest == "bhoreal" and midiname[port].find(BhorealMidiName) == 0:
|
||||
midiport[port].send_message([NOTE_OFF, note%64, 0])
|
||||
gstt.BhorLeds[note%64] = 0
|
||||
#bhorosc.sendosc("/bhoreal", [note%64 , 0])
|
||||
'''
|
||||
|
||||
|
||||
|
||||
# Generic call back : new msg forwarded to queue
|
||||
|
|
@ -576,8 +554,8 @@ def listdevice(number):
|
|||
|
||||
|
||||
|
||||
# return device name number for given mididevice and midichannel
|
||||
def findJamDevice(mididevice, midichan):
|
||||
# return device name for given mididevice and midichannel
|
||||
def findJamName(mididevice, midichan):
|
||||
|
||||
#print("searching", mididevice, "channel", midichan,'...')
|
||||
|
||||
|
|
@ -593,6 +571,22 @@ def findJamDevice(mididevice, midichan):
|
|||
return "None"
|
||||
|
||||
|
||||
# return all midi devices for given name
|
||||
def findJamDevices(name):
|
||||
|
||||
devices = []
|
||||
print ("searching", name)
|
||||
for (k, v) in Confs.items():
|
||||
|
||||
if v[0]["type"] == "mididevice":
|
||||
#print(k, name,k.find(name))
|
||||
if k.find(name) != -1:
|
||||
#print(v[0]["mididevice"])
|
||||
devices.append(v[0]["mididevice"])
|
||||
#print(devices)
|
||||
return devices
|
||||
|
||||
|
||||
|
||||
def check():
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue