- Added wait for devices if none connected
This commit is contained in:
parent
553892b034
commit
076f169c29
25
ashost.py
25
ashost.py
@ -6,6 +6,19 @@ import os
|
|||||||
import time
|
import time
|
||||||
import mido
|
import mido
|
||||||
|
|
||||||
|
def check_devices() -> tuple:
|
||||||
|
# Retrieve the list of available input devices
|
||||||
|
devices_in = mido.get_input_names()
|
||||||
|
devices_out = mido.get_output_names()
|
||||||
|
|
||||||
|
devices_in = remove_through_ports(devices_in)
|
||||||
|
devices_out = remove_through_ports(devices_out)
|
||||||
|
print("Available MIDI input devices:", devices_in)
|
||||||
|
|
||||||
|
return devices_in, devices_out
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def match_device_name(input_name, output_list):
|
def match_device_name(input_name, output_list):
|
||||||
# Function to match device names flexibly
|
# Function to match device names flexibly
|
||||||
for device in output_list:
|
for device in output_list:
|
||||||
@ -139,13 +152,13 @@ def relay_midi_host_to_out(host_name, devices_out):
|
|||||||
main_run()
|
main_run()
|
||||||
|
|
||||||
def main_run():
|
def main_run():
|
||||||
# Retrieve the list of available input devices
|
|
||||||
devices_in = mido.get_input_names()
|
|
||||||
devices_out = mido.get_output_names()
|
|
||||||
|
|
||||||
devices_in = remove_through_ports(devices_in)
|
devices_in, devices_out = check_devices()
|
||||||
devices_out = remove_through_ports(devices_out)
|
|
||||||
print("Available MIDI input devices:", devices_in)
|
# Check if at least one and one output device is connected
|
||||||
|
while len(devices_in) < 1 and len(devices_out) < 1:
|
||||||
|
time.sleep(3)
|
||||||
|
main_run()
|
||||||
|
|
||||||
base_frequency = 130 # Starting frequency in Hz
|
base_frequency = 130 # Starting frequency in Hz
|
||||||
increment = 50 # Frequency increment for each device
|
increment = 50 # Frequency increment for each device
|
||||||
|
Loading…
Reference in New Issue
Block a user