12
12
DESIRED_CONNECTIONS = [
13
13
("Midi Through:Midi Through Port-0" , "Pure Data:Pure Data Midi-In 2" ),
14
14
("Pure Data:Pure Data Midi-Out 1" , "Pure Data:Pure Data Midi-In 2" ),
15
- ("Pure Data:2" , "Pure Data:0 " ),
15
+ ("Pure Data:2" , "Pure Data:1 " ),
16
16
# Example: ("20:0", "128:0"),
17
17
]
18
18
@@ -544,7 +544,7 @@ def get_port_map(self):
544
544
Builds a map of port strings to their client/port IDs.
545
545
Handles arbitrary combinations of names and IDs:
546
546
- "ClientName:PortName"
547
- - "ClientID:PortID"
547
+ - "ClientID:PortID"
548
548
- "ClientName:PortID"
549
549
- "ClientID:PortName"
550
550
"""
@@ -556,7 +556,7 @@ def get_port_map(self):
556
556
client_by_name = {} # {client_name: client_id}
557
557
port_by_client_port_id = {} # {(client_id, port_id): port_name}
558
558
port_by_client_name = {} # {(client_name, port_name): (client_id, port_id)}
559
-
559
+
560
560
cinfo_ptr = snd_seq_client_info_t ()
561
561
pinfo_ptr = snd_seq_port_info_t ()
562
562
alsalib .snd_seq_client_info_malloc (ctypes .byref (cinfo_ptr ))
@@ -568,7 +568,7 @@ def get_port_map(self):
568
568
client_name = alsalib .snd_seq_client_info_get_name (cinfo_ptr ).decode (
569
569
"utf-8"
570
570
)
571
-
571
+
572
572
client_by_id [client_id ] = client_name
573
573
client_by_name [client_name ] = client_id
574
574
@@ -579,32 +579,35 @@ def get_port_map(self):
579
579
port_name = alsalib .snd_seq_port_info_get_name (pinfo_ptr ).decode (
580
580
"utf-8"
581
581
)
582
-
582
+
583
583
# Store bidirectional mappings
584
584
port_by_client_port_id [(addr .client , addr .port )] = port_name
585
585
port_by_client_name [(client_name , port_name )] = (addr .client , addr .port )
586
586
587
587
alsalib .snd_seq_client_info_free (cinfo_ptr )
588
588
alsalib .snd_seq_port_info_free (pinfo_ptr )
589
-
589
+
590
590
# Build final port map with all possible combinations
591
591
port_map = {}
592
-
592
+
593
593
# Add basic mappings
594
594
for (client_id , port_id ), port_name in port_by_client_port_id .items ():
595
595
client_name = client_by_id [client_id ]
596
596
# Full name mapping
597
597
port_map [f"{ client_name } :{ port_name } " ] = (client_id , port_id )
598
598
# Full ID mapping
599
599
port_map [f"{ client_id } :{ port_id } " ] = (client_id , port_id )
600
-
600
+
601
601
# Add mixed mappings
602
- for (client_name , port_name ), (client_id , port_id ) in port_by_client_name .items ():
602
+ for (client_name , port_name ), (
603
+ client_id ,
604
+ port_id ,
605
+ ) in port_by_client_name .items ():
603
606
# Client name + port ID
604
607
port_map [f"{ client_name } :{ port_id } " ] = (client_id , port_id )
605
608
# Client ID + port name
606
609
port_map [f"{ client_id } :{ port_name } " ] = (client_id , port_id )
607
-
610
+
608
611
return port_map
609
612
610
613
def reconcile_connections (self ):
0 commit comments