- Added throughport filter
This commit is contained in:
		
							
								
								
									
										15
									
								
								ashost.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								ashost.py
									
									
									
									
									
								
							| @@ -19,6 +19,12 @@ def match_device_name(input_name, output_list): | |||||||
|  |  | ||||||
|     return None |     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: | def determine_host(devices_in: list) -> str: | ||||||
|     master = None |     master = None | ||||||
| @@ -133,14 +139,17 @@ def main_run(): | |||||||
|     midi_host_in = determine_host(devices_in) |     midi_host_in = determine_host(devices_in) | ||||||
|     print(midi_host_in) |     print(midi_host_in) | ||||||
|  |  | ||||||
|  |     devices_out_filtered = remove_through_ports(devices_out) | ||||||
|  |  | ||||||
|     # Find and remove the matching output device to avoid feedback |     # 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: |     if matching_output_device: | ||||||
|         devices_out.remove(matching_output_device) |         devices_out_filtered.remove(matching_output_device) | ||||||
|  |  | ||||||
|     if midi_host_in: |     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() | main_run() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user