Skip to content

Commit 8ff4b26

Browse files
committed
fix: update Pure Data MIDI connection from port 0 to port 1
1 parent e18da35 commit 8ff4b26

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

alsa.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
DESIRED_CONNECTIONS = [
1313
("Midi Through:Midi Through Port-0", "Pure Data:Pure Data Midi-In 2"),
1414
("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"),
1616
# Example: ("20:0", "128:0"),
1717
]
1818

@@ -544,7 +544,7 @@ def get_port_map(self):
544544
Builds a map of port strings to their client/port IDs.
545545
Handles arbitrary combinations of names and IDs:
546546
- "ClientName:PortName"
547-
- "ClientID:PortID"
547+
- "ClientID:PortID"
548548
- "ClientName:PortID"
549549
- "ClientID:PortName"
550550
"""
@@ -556,7 +556,7 @@ def get_port_map(self):
556556
client_by_name = {} # {client_name: client_id}
557557
port_by_client_port_id = {} # {(client_id, port_id): port_name}
558558
port_by_client_name = {} # {(client_name, port_name): (client_id, port_id)}
559-
559+
560560
cinfo_ptr = snd_seq_client_info_t()
561561
pinfo_ptr = snd_seq_port_info_t()
562562
alsalib.snd_seq_client_info_malloc(ctypes.byref(cinfo_ptr))
@@ -568,7 +568,7 @@ def get_port_map(self):
568568
client_name = alsalib.snd_seq_client_info_get_name(cinfo_ptr).decode(
569569
"utf-8"
570570
)
571-
571+
572572
client_by_id[client_id] = client_name
573573
client_by_name[client_name] = client_id
574574

@@ -579,32 +579,35 @@ def get_port_map(self):
579579
port_name = alsalib.snd_seq_port_info_get_name(pinfo_ptr).decode(
580580
"utf-8"
581581
)
582-
582+
583583
# Store bidirectional mappings
584584
port_by_client_port_id[(addr.client, addr.port)] = port_name
585585
port_by_client_name[(client_name, port_name)] = (addr.client, addr.port)
586586

587587
alsalib.snd_seq_client_info_free(cinfo_ptr)
588588
alsalib.snd_seq_port_info_free(pinfo_ptr)
589-
589+
590590
# Build final port map with all possible combinations
591591
port_map = {}
592-
592+
593593
# Add basic mappings
594594
for (client_id, port_id), port_name in port_by_client_port_id.items():
595595
client_name = client_by_id[client_id]
596596
# Full name mapping
597597
port_map[f"{client_name}:{port_name}"] = (client_id, port_id)
598598
# Full ID mapping
599599
port_map[f"{client_id}:{port_id}"] = (client_id, port_id)
600-
600+
601601
# 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():
603606
# Client name + port ID
604607
port_map[f"{client_name}:{port_id}"] = (client_id, port_id)
605608
# Client ID + port name
606609
port_map[f"{client_id}:{port_name}"] = (client_id, port_id)
607-
610+
608611
return port_map
609612

610613
def reconcile_connections(self):

0 commit comments

Comments
 (0)