Skip to content

Commit

Permalink
Merge pull request #175 from sadguitarius/pipewire-connection-fix
Browse files Browse the repository at this point in the history
Pipewire connection fix
  • Loading branch information
x37v authored Oct 31, 2024
2 parents d9da688 + 6381832 commit 1545015
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/actions/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export const deletePortsAliases = (portNames: Array<GraphPortRecord["portName"]>
};
};

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

const filterSystemNodeNames = (portNames: string[], nodes: Array<GraphPatcherNodeRecord | GraphControlNodeRecord>): string[] => {
const pNodeIds = new Set(nodes.map(pn => pn.id));
Expand Down Expand Up @@ -459,7 +459,8 @@ const createConnectionRecordsFromSinkList = (state: RootStateType, sourceNode: G
const connectionRecords: GraphConnectionRecord[] = [];

for (const sink of sinks) {
const [sinkNodeName, sinkPortId] = sink.split(":");
const [sinkNodeName, ...rest] = sink.split(":");
const sinkPortId = rest.join(":");

const sinkNode = getNode(state, sinkNodeName) || getSystemNodeByJackNameAndDirection(state, sinkNodeName, PortDirection.Sink);
if (!sinkNode) continue;
Expand All @@ -486,7 +487,8 @@ export const initConnections = (connectionsInfo: OSCQueryRNBOJackConnections): A
const connectionRecords: GraphConnectionRecord[] = [];

for (const [source, connections] of Object.entries(connectionsInfo.CONTENTS.audio?.CONTENTS || {})) {
const [sourceNodeName, sourcePortId] = source.split(":");
const [sourceNodeName, ...rest] = source.split(":");
const sourcePortId = rest.join(":");

const sourceNode = getNode(state, sourceNodeName) || getSystemNodeByJackNameAndDirection(state, sourceNodeName, PortDirection.Source);
if (!sourceNode) continue;
Expand All @@ -498,7 +500,8 @@ export const initConnections = (connectionsInfo: OSCQueryRNBOJackConnections): A
}

for (const [source, connections] of Object.entries(connectionsInfo.CONTENTS.midi?.CONTENTS || {})) {
const [sourceNodeName, sourcePortId] = source.split(":");
const [sourceNodeName, ...rest] = source.split(":");
const sourcePortId = rest.join(":");

const sourceNode = getNode(state, sourceNodeName) || getSystemNodeByJackNameAndDirection(state, sourceNodeName, PortDirection.Source);
if (!sourceNode) continue;
Expand Down Expand Up @@ -876,7 +879,8 @@ export const updateSourcePortConnections = (source: string, sinks: string[]): Ap
try {
const state = getState();

const [sourceNodeName, sourcePortId] = source.split(":");
const [sourceNodeName, ...rest] = source.split(":");
const sourcePortId = rest.join(":");

const sourceNode = getNode(state, sourceNodeName) || getSystemNodeByJackNameAndDirection(state, sourceNodeName, PortDirection.Source);
if (!sourceNode) return;
Expand Down
2 changes: 1 addition & 1 deletion src/components/editor/port.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const EditorPort: FunctionComponent<PortProps> = memo(function WrappedPort({
id={ port.id }
position={ handlePositionByPortDirection[port.direction] }
data-c74-type={ port.type }
data-c74-name={ alias || port.id }
data-c74-name={ (alias || port.id.replace(/\((capture|playback)_[0-9+]\)/, "")) }
type={ handleTypeByPortDirection[port.direction] }
style={{ top: `${offset}%` }}
/>
Expand Down

0 comments on commit 1545015

Please sign in to comment.