mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-11 19:00:04 +01:00
fixed midi port bug
This commit is contained in:
@@ -35,11 +35,13 @@ class MidiInput(object):
|
||||
|
||||
def open_this_port_and_start_listening(self, port_phrase):
|
||||
midi_ports = mido.get_input_names()
|
||||
midi_device_on_port = [s for s in midi_ports if port_phrase in s]
|
||||
if midi_device_on_port:
|
||||
midi_devices = [s for s in midi_ports if not ('Midi Through' in s)]
|
||||
if port_phrase == 'serial':
|
||||
midi_devices = [s for s in midi_devices if port_phrase in s]
|
||||
if midi_devices:
|
||||
if self.data.midi_status == 'disconnected':
|
||||
subport_index = self.port_index % len(midi_device_on_port)
|
||||
self.midi_device = mido.open_input(midi_device_on_port[subport_index])
|
||||
subport_index = self.port_index % len(midi_devices)
|
||||
self.midi_device = mido.open_input(midi_devices[subport_index])
|
||||
self.data.midi_status = 'connected'
|
||||
self.message_handler.set_message('INFO', 'connected to midi device {}'.format(self.midi_device.name))
|
||||
self.poll_midi_input()
|
||||
|
||||
Reference in New Issue
Block a user