OP-Z Device detection added
OP-Z Midi device iss called different on each platform so now it is detected by underbridge automatically.
This commit is contained in:
parent
20081db7f1
commit
19e90ce808
@ -10,6 +10,8 @@ import time
|
|||||||
import threading
|
import threading
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
device_list = []
|
||||||
|
op_device = []
|
||||||
loop_time = 0
|
loop_time = 0
|
||||||
inport = 0
|
inport = 0
|
||||||
outport = 0
|
outport = 0
|
||||||
@ -24,11 +26,22 @@ cancel = 0
|
|||||||
|
|
||||||
|
|
||||||
def getMIDIDevice():
|
def getMIDIDevice():
|
||||||
pass
|
global device_list
|
||||||
|
global op_device
|
||||||
|
device_list = mido.get_output_names()
|
||||||
|
print (device_list)
|
||||||
|
try:
|
||||||
|
op_device = list(filter(lambda x: 'OP-Z' in x, device_list))
|
||||||
|
op_device = op_device[0]
|
||||||
|
print (op_device)
|
||||||
|
displaymsg.set("OP-Z found")
|
||||||
|
except:
|
||||||
|
displaymsg.set("Can´t find OP-Z : MIDI Error")
|
||||||
|
|
||||||
|
|
||||||
def getBPM():
|
def getBPM():
|
||||||
inport= mido.open_input('OP-Z:OP-Z MIDI 1 20:0')
|
global op_device
|
||||||
|
inport= mido.open_input(op_device)
|
||||||
msg = inport.poll()
|
msg = inport.poll()
|
||||||
#print(msg)
|
#print(msg)
|
||||||
|
|
||||||
@ -54,8 +67,9 @@ def setParam():
|
|||||||
|
|
||||||
def openMidi():
|
def openMidi():
|
||||||
global outport
|
global outport
|
||||||
outport= mido.open_output('OP-Z:OP-Z MIDI 1 20:0')
|
global op_device
|
||||||
displaymsg.set("OP-Z MIDI not connected :(")
|
outport= mido.open_output(op_device)
|
||||||
|
#displaymsg.set("OP-Z MIDI not connected :(")
|
||||||
print(outport)
|
print(outport)
|
||||||
|
|
||||||
def setProject(projnr):
|
def setProject(projnr):
|
||||||
@ -187,7 +201,12 @@ def sequenceMaster():
|
|||||||
global pattern_nr
|
global pattern_nr
|
||||||
cancel = 0
|
cancel = 0
|
||||||
#print("test")
|
#print("test")
|
||||||
|
|
||||||
|
getMIDIDevice()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
displaymsg.set("Sequence started")
|
displaymsg.set("Sequence started")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
openMidi()
|
openMidi()
|
||||||
|
|
||||||
@ -321,4 +340,6 @@ start_recording.grid(row = 0, column = 5, padx =5, pady =2)
|
|||||||
tutorial.grid(row = 1, column = 0, padx =5, pady =5, columnspan=5)
|
tutorial.grid(row = 1, column = 0, padx =5, pady =5, columnspan=5)
|
||||||
display.grid(row = 1, column = 0, padx =2, pady =10, columnspan= 7)
|
display.grid(row = 1, column = 0, padx =2, pady =10, columnspan= 7)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
root.mainloop()
|
root.mainloop()
|
Loading…
Reference in New Issue
Block a user