|
|
@@ -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",
|