- Added throughport filter

This commit is contained in:
bklronin 2024-06-26 22:12:37 +02:00
parent e4b52c1066
commit 9f00bf1b9c

View File

@ -19,6 +19,12 @@ def match_device_name(input_name, output_list):
return None
def remove_through_ports(output_ports):
# Filter out ports containing "Through" in their names
filtered_ports = [port for port in output_ports if 'through' not in port.lower()]
return filtered_ports
def determine_host(devices_in: list) -> str:
master = None
@ -133,14 +139,17 @@ def main_run():
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)
matching_output_device = match_device_name(midi_host_in, devices_out_filtered)
print("Filtering", matching_output_device)
if matching_output_device:
devices_out.remove(matching_output_device)
devices_out_filtered.remove(matching_output_device)
if midi_host_in:
relay_midi_host_to_out(midi_host_in, devices_out)
relay_midi_host_to_out(midi_host_in, devices_out_filtered)
main_run()