Johan Le Baut 4 giorni fa
parent
commit
1e6e5db8ef

+ 15 - 8
artifacts/mod-ui/arm64/current/app/mod/rigforge_pipewire.py

@@ -72,6 +72,10 @@ def resolve_pedalboard_port(port, resolve_host_port):
             "output_l": "lv2_audio_out_1",
             "input_r": "lv2_audio_in_2",
             "output_r": "lv2_audio_out_2",
+            "lv2_audio_in_1": "lv2_audio_in_1",
+            "lv2_audio_out_1": "lv2_audio_out_1",
+            "lv2_audio_in_2": "lv2_audio_in_2",
+            "lv2_audio_out_2": "lv2_audio_out_2",
         },
     }
     resolved_symbol = effect_ports.get(instance, {}).get(symbol)
@@ -107,6 +111,11 @@ def pedalboard_connection(
         captures = {}
     if "/" in destination_path and not destination_is_playback:
         playbacks = {}
+    # mod-ui's effect/connect route may pass bare boundary symbols and its
+    # generic host-port resolver can turn playback_4 into system:playback_4.
+    # Resolve an explicit Rigforge boundary pair before trying JACK aliases.
+    if source_path in captures and destination_path in playbacks:
+        return "pipewire", (captures[source_path], playbacks[destination_path])
     # mod-ui's HTTP route passes bare hardware symbols ("capture_3"), but the
     # saved-board loader passes "/graph/capture_3". Preserve the latter marker:
     # if the opposite endpoint cannot be resolved as a Rigforge plugin port,
@@ -135,20 +144,18 @@ def pedalboard_connection(
         and is_rigforge_managed_boundary_port(port_from)
         and destination_path.startswith("rigforge_")
     ):
-        pipewire_link = (
-            captures[source_path],
-            resolve_pedalboard_port(port_to, resolve_host_port),
-        )
+        resolved_destination = resolve_pedalboard_port(port_to, resolve_host_port)
+        if resolved_destination is not None:
+            pipewire_link = (captures[source_path], resolved_destination)
     if (
         pipewire_link is None
         and destination_path in playbacks
         and is_rigforge_managed_boundary_port(port_to)
         and source_path.startswith("rigforge_")
     ):
-        pipewire_link = (
-            resolve_pedalboard_port(port_from, resolve_host_port),
-            playbacks[destination_path],
-        )
+        resolved_source = resolve_pedalboard_port(port_from, resolve_host_port)
+        if resolved_source is not None:
+            pipewire_link = (resolved_source, playbacks[destination_path])
     if pipewire_link is not None:
         return "pipewire", pipewire_link
     if boundary_endpoint:

+ 15 - 8
build/arm64/mod_ui_pipewire.py

@@ -72,6 +72,10 @@ def resolve_pedalboard_port(port, resolve_host_port):
             "output_l": "lv2_audio_out_1",
             "input_r": "lv2_audio_in_2",
             "output_r": "lv2_audio_out_2",
+            "lv2_audio_in_1": "lv2_audio_in_1",
+            "lv2_audio_out_1": "lv2_audio_out_1",
+            "lv2_audio_in_2": "lv2_audio_in_2",
+            "lv2_audio_out_2": "lv2_audio_out_2",
         },
     }
     resolved_symbol = effect_ports.get(instance, {}).get(symbol)
@@ -107,6 +111,11 @@ def pedalboard_connection(
         captures = {}
     if "/" in destination_path and not destination_is_playback:
         playbacks = {}
+    # mod-ui's effect/connect route may pass bare boundary symbols and its
+    # generic host-port resolver can turn playback_4 into system:playback_4.
+    # Resolve an explicit Rigforge boundary pair before trying JACK aliases.
+    if source_path in captures and destination_path in playbacks:
+        return "pipewire", (captures[source_path], playbacks[destination_path])
     # mod-ui's HTTP route passes bare hardware symbols ("capture_3"), but the
     # saved-board loader passes "/graph/capture_3". Preserve the latter marker:
     # if the opposite endpoint cannot be resolved as a Rigforge plugin port,
@@ -135,20 +144,18 @@ def pedalboard_connection(
         and is_rigforge_managed_boundary_port(port_from)
         and destination_path.startswith("rigforge_")
     ):
-        pipewire_link = (
-            captures[source_path],
-            resolve_pedalboard_port(port_to, resolve_host_port),
-        )
+        resolved_destination = resolve_pedalboard_port(port_to, resolve_host_port)
+        if resolved_destination is not None:
+            pipewire_link = (captures[source_path], resolved_destination)
     if (
         pipewire_link is None
         and destination_path in playbacks
         and is_rigforge_managed_boundary_port(port_to)
         and source_path.startswith("rigforge_")
     ):
-        pipewire_link = (
-            resolve_pedalboard_port(port_from, resolve_host_port),
-            playbacks[destination_path],
-        )
+        resolved_source = resolve_pedalboard_port(port_from, resolve_host_port)
+        if resolved_source is not None:
+            pipewire_link = (resolved_source, playbacks[destination_path])
     if pipewire_link is not None:
         return "pipewire", pipewire_link
     if boundary_endpoint:

+ 67 - 0
build/arm64/patch_mod_ui_rigforge.py

@@ -169,6 +169,72 @@ def patch_host_connection_methods(host):
     )
 
 
+def patch_pipewire_helper(helper):
+    """Keep bare Rigforge boundary-to-boundary cables on concrete PipeWire ports."""
+    text = helper.read_text(encoding="utf-8")
+    marker = '''    if "/" in destination_path and not destination_is_playback:
+        playbacks = {}
+'''
+    replacement = marker + '''    # mod-ui's effect/connect route may pass bare boundary symbols and its
+    # generic host-port resolver can turn playback_4 into system:playback_4.
+    # Resolve an explicit Rigforge boundary pair before trying JACK aliases.
+    if source_path in captures and destination_path in playbacks:
+        return "pipewire", (captures[source_path], playbacks[destination_path])
+'''
+    if replacement in text:
+        updated = text
+    else:
+        if text.count(marker) != 1:
+            raise RuntimeError(f"could not identify boundary resolution block in {helper}")
+        updated = text.replace(marker, replacement, 1)
+
+    reverb_marker = '''            "output_r": "lv2_audio_out_2",
+        },
+'''
+    reverb_replacement = '''            "output_r": "lv2_audio_out_2",
+            "lv2_audio_in_1": "lv2_audio_in_1",
+            "lv2_audio_out_1": "lv2_audio_out_1",
+            "lv2_audio_in_2": "lv2_audio_in_2",
+            "lv2_audio_out_2": "lv2_audio_out_2",
+        },
+'''
+    if reverb_replacement not in updated:
+        if updated.count(reverb_marker) != 1:
+            raise RuntimeError(f"could not identify reverb port map in {helper}")
+        updated = updated.replace(reverb_marker, reverb_replacement, 1)
+
+    source_marker = '''        pipewire_link = (
+            captures[source_path],
+            resolve_pedalboard_port(port_to, resolve_host_port),
+        )
+'''
+    source_replacement = '''        resolved_destination = resolve_pedalboard_port(port_to, resolve_host_port)
+        if resolved_destination is not None:
+            pipewire_link = (captures[source_path], resolved_destination)
+'''
+    if source_replacement not in updated:
+        if updated.count(source_marker) != 1:
+            raise RuntimeError(f"could not identify boundary source resolution in {helper}")
+        updated = updated.replace(source_marker, source_replacement, 1)
+
+    destination_marker = '''        pipewire_link = (
+            resolve_pedalboard_port(port_from, resolve_host_port),
+            playbacks[destination_path],
+        )
+'''
+    destination_replacement = '''        resolved_source = resolve_pedalboard_port(port_from, resolve_host_port)
+        if resolved_source is not None:
+            pipewire_link = (resolved_source, playbacks[destination_path])
+'''
+    if destination_replacement not in updated:
+        if updated.count(destination_marker) != 1:
+            raise RuntimeError(f"could not identify boundary destination resolution in {helper}")
+        updated = updated.replace(destination_marker, destination_replacement, 1)
+
+    if updated != text:
+        helper.write_text(updated, encoding="utf-8")
+
+
 def patch_hardware_count_reporting(app):
     """Report Rigforge's four mapped boundaries, not only hardware RDF ports."""
     javascript = app / "html" / "js" / "pedalboard.js"
@@ -402,6 +468,7 @@ def apply(source_root):
     app = Path(source_root)
     patch_hardware_count_reporting(app)
     helper = Path(__file__).with_name("mod_ui_pipewire.py")
+    patch_pipewire_helper(helper)
     (app / "mod" / "rigforge_pipewire.py").write_bytes(helper.read_bytes())
     replace_if_present(
         app / "mod" / "host.py",