From 9e01adbce541ffde52247da37b228bc87d98bc96 Mon Sep 17 00:00:00 2001 From: bklronin Date: Wed, 26 Jun 2024 22:15:29 +0200 Subject: [PATCH] - Added throughport filter --- ashost.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ashost.py b/ashost.py index 69218db..123a48a 100644 --- a/ashost.py +++ b/ashost.py @@ -19,9 +19,9 @@ def match_device_name(input_name, output_list): return None -def remove_through_ports(output_ports): +def remove_through_ports(ports): # Filter out ports containing "Through" in their names - filtered_ports = [port for port in output_ports if 'through' not in port.lower()] + filtered_ports = [port for port in ports if 'through' not in port.lower()] return filtered_ports @@ -135,21 +135,22 @@ def main_run(): devices_out = mido.get_output_names() print("Available MIDI input devices:", devices_in) + devices_in = remove_through_ports(devices_in) + devices_out = remove_through_ports(devices_out) + # Listen for devices that send start and return the host name midi_host_in = determine_host(devices_in) print(midi_host_in) - devices_out_filtered = remove_through_ports(devices_out) - # Find and remove the matching output device to avoid feedback - matching_output_device = match_device_name(midi_host_in, devices_out_filtered) + matching_output_device = match_device_name(midi_host_in, devices_out) print("Filtering", matching_output_device) if matching_output_device: - devices_out_filtered.remove(matching_output_device) + devices_out.remove(matching_output_device) if midi_host_in: - relay_midi_host_to_out(midi_host_in, devices_out_filtered) + relay_midi_host_to_out(midi_host_in, devices_out) main_run()