Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long port names overlap each other in graph #173

Open
x37v opened this issue Sep 5, 2024 · 4 comments
Open

long port names overlap each other in graph #173

x37v opened this issue Sep 5, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@x37v
Copy link
Contributor

x37v commented Sep 5, 2024

image

I'm running via pipewire.. it creates a node called Midi-Bridge

here are its aliases

Midi-Bridge:Midi Through:(capture_0) Midi Through Port-0
   alsa:seq:default:client_14:capture_0
   Midi Through:Midi Through Port-0
Midi-Bridge:pisound:(capture_0) pisound MIDI PS-0MTS4NJ
   alsa:seq:default:client_24:capture_0
   pisound:pisound MIDI PS-0MTS4NJ

Midi-Bridge:Midi Through:(playback_0) Midi Through Port-0
   alsa:seq:default:client_14:playback_0
   Midi Through:Midi Through Port-0
Midi-Bridge:pisound:(playback_0) pisound MIDI PS-0MTS4NJ
   alsa:seq:default:client_24:playback_0
@x37v x37v added the bug Something isn't working label Sep 5, 2024
@sadguitarius
Copy link

Hello, continuing the discussion from Discord and referencing #174 since I believe it may stem from the same source. If I change isSystemNodeName in actions/graph.ts to

const isSystemNodeName = (name: string): boolean => {
	return (name.startsWith("system") || name.startsWith("node") || name.startsWith("Midi-Bridge"));
}

I get a more sensible display, but the connections still don't appear. It looks like some logic is necessary so that port aliases are not used for the Pipewire ports and instead the actual port name should be used for display. So if the port name is "Midi-Bridge:Midi Through:(playback_0) Midi Through Port-0" parse that so you get just "Midi Through Port-0".

Not sure why the connections aren't working, but I guess the RNBO runner knows about the ports just by parsing names, right? So maybe something is up with how the parser gets the port info when it's a PipeWire-generated port.

Screenshot 2024-09-23 103931

@sadguitarius
Copy link

Ok this is a little bit better. This is with a combination of using jack.fill-aliases = true in jack.conf in the PipeWire config and then conditionally picking which alias to use depending on the port name in the rnbo-runner-panel code. Still some weird naming of the Pisound interface, which shows up here as "PS-388SF7P snd-soc-dummy-dai-0" (turns out that's id of the capture/playback devices on the card), but I think this can be dealt with somehow in the PipeWire config. I guess there could also be some kind of parsing of audio port names to detect ALSA hw interfaces and make the i/o more sensible.

Connections are successfully made when dragging between nodes in the interface, but the wires still don't show up.

Screenshot 2024-09-24 094707

@sadguitarius
Copy link

here's the patch for rnbo-runner-panel btw:

diff --git a/src/actions/graph.ts b/src/actions/graph.ts
index a300a8e..6f6f19a 100644
--- a/src/actions/graph.ts
+++ b/src/actions/graph.ts
@@ -267,7 +267,13 @@ export const deletePortsAliases = (portNames: Array<GraphPortRecord["portName"]>
 	};
 };
 
-const isSystemNodeName = (name: string): boolean => name.startsWith("system");
+const isSystemNodeName = (name: string): boolean => {
+	if (name.startsWith("system") || name.startsWith("node") || name.startsWith("Midi-Bridge")) {
+		console.log(name + " is a system port");
+	}
+
+	return (name.startsWith("system") || name.startsWith("node") || name.startsWith("Midi-Bridge"));
+}
 
 const filterSystemNodeNames = (portNames: string[], nodes: Array<GraphPatcherNodeRecord | GraphControlNodeRecord>): string[] => {
 	const pNodeIds = new Set(nodes.map(pn => pn.id));
diff --git a/src/selectors/graph.ts b/src/selectors/graph.ts
index 79b1c2d..956931d 100644
--- a/src/selectors/graph.ts
+++ b/src/selectors/graph.ts
@@ -161,7 +161,9 @@ export const getPortAlias = createSelector(
 		// For now we only alias system node ports
 		return portName.startsWith("system")
 			? aliases.get(portName)?.[0] || undefined
-			: undefined;
+			: portName.startsWith("Midi-Bridge")
+				? aliases.get(portName)?.[1] || undefined
+				: undefined;
 	}
 );
 
@@ -175,7 +177,7 @@ export const getPortAliasesForNode = createSelector(
 			node.ports.valueSeq().forEach(port => {
 				const alias = aliases.get(port.portName);
 				if (alias?.length) {
-					map.set(port.portName, alias[0]);
+					map.set(port.portName, port.portName.startsWith("Midi-Bridge") ? alias[1] : alias[0]);
 				}
 			});
 		});

@sadguitarius
Copy link

Weird interface name can be fixed with a Wireplumber rule, e.g.

monitor.alsa.rules = [
  {
    matches = [
      {
        api.alsa.card.name = "pisound"
      }
    ]
    actions = {
      update-props = {
        node.nick = "pisound"
      }
    }
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants