|
|
@@ -163,6 +163,14 @@ class ModUiPipeWireTests(unittest.TestCase):
|
|
|
"/graph/rigforge_voice_reverb/output_l",
|
|
|
"effect_5:lv2_audio_out_1",
|
|
|
),
|
|
|
+ (
|
|
|
+ "/graph/rigforge_voice_reverb/input_r",
|
|
|
+ "effect_5:lv2_audio_in_2",
|
|
|
+ ),
|
|
|
+ (
|
|
|
+ "/graph/rigforge_voice_reverb/output_r",
|
|
|
+ "effect_5:lv2_audio_out_2",
|
|
|
+ ),
|
|
|
):
|
|
|
self.assertEqual(resolve_pedalboard_port(graph_port, resolver), expected)
|
|
|
self.assertEqual(
|
|
|
@@ -207,37 +215,61 @@ class ModUiPipeWireTests(unittest.TestCase):
|
|
|
),
|
|
|
),
|
|
|
)
|
|
|
+ self.assertEqual(
|
|
|
+ resolve_pedalboard_port(
|
|
|
+ "/graph/rigforge_voice_reverb/input_r", resolver
|
|
|
+ ),
|
|
|
+ "effect_5:lv2_audio_in_2",
|
|
|
+ )
|
|
|
+ self.assertEqual(
|
|
|
+ resolve_pedalboard_port(
|
|
|
+ "/graph/rigforge_voice_reverb/output_r", resolver
|
|
|
+ ),
|
|
|
+ "effect_5:lv2_audio_out_2",
|
|
|
+ )
|
|
|
|
|
|
def test_boundary_failures_never_fall_back_to_guessed_jack_ports(self):
|
|
|
def resolve(port):
|
|
|
return f"system:{port.rsplit('/', 1)[-1]}"
|
|
|
|
|
|
- self.assertIsNone(
|
|
|
+ self.assertEqual(
|
|
|
pedalboard_connection(
|
|
|
"/graph/capture_3",
|
|
|
"/graph/rigforge_voice_high_pass/in",
|
|
|
{"capture_3": "rigforge.mod-host-input.capture:capture_AUX2"},
|
|
|
{},
|
|
|
resolve,
|
|
|
- )
|
|
|
+ ),
|
|
|
+ (
|
|
|
+ "pipewire",
|
|
|
+ (
|
|
|
+ "rigforge.mod-host-input.capture:capture_AUX2",
|
|
|
+ "effect_2:in",
|
|
|
+ ),
|
|
|
+ ),
|
|
|
)
|
|
|
- self.assertIsNone(
|
|
|
+ self.assertEqual(
|
|
|
pedalboard_connection(
|
|
|
"/graph/rigforge_voice_de_esser/out",
|
|
|
"/graph/rigforge_voice_reverb/input_l",
|
|
|
- {},
|
|
|
+ {"capture_1": "rigforge.mod-host-input.capture:capture_AUX0"},
|
|
|
{},
|
|
|
resolve,
|
|
|
- )
|
|
|
+ ),
|
|
|
+ ("jack", ("effect_4:out", "effect_5:lv2_audio_in_1")),
|
|
|
)
|
|
|
- self.assertIsNone(
|
|
|
+ self.assertEqual(
|
|
|
pedalboard_connection(
|
|
|
- "/capture_3",
|
|
|
+ "capture_3",
|
|
|
"/graph/rigforge_voice_high_pass/in",
|
|
|
{"capture_3": "rigforge.mod-host-input.capture:capture_AUX2"},
|
|
|
{},
|
|
|
resolve,
|
|
|
- )
|
|
|
+ ),
|
|
|
+ (
|
|
|
+ "pipewire",
|
|
|
+ ("rigforge.mod-host-input.capture:capture_AUX2", "effect_2:in"),
|
|
|
+ ),
|
|
|
)
|
|
|
|
|
|
def test_voice_plugin_connections_resolve_to_the_loaded_plugin_ids(self):
|
|
|
@@ -338,6 +370,86 @@ class ModUiPipeWireTests(unittest.TestCase):
|
|
|
),
|
|
|
)
|
|
|
|
|
|
+ def test_load_restore_patch_keeps_fourth_channel_even_when_hardware_count_is_three(self):
|
|
|
+ with tempfile.TemporaryDirectory() as temporary:
|
|
|
+ host = Path(temporary) / "host.py"
|
|
|
+ host.write_text(
|
|
|
+ " def _fix_host_connection_port(self, port):\n"
|
|
|
+ " data = port.split(\"/\")\n"
|
|
|
+ " return data[-1]\n\n"
|
|
|
+ " def load_pb_connections(self, connections, mappedOldMidiIns, mappedOldMidiOuts, mappedNewMidiIns, mappedNewMidiOuts):\n"
|
|
|
+ " for c in connections:\n"
|
|
|
+ " doConnectionNow = True\n"
|
|
|
+ " aliasname1 = aliasname2 = None\n"
|
|
|
+ " port_from = \"/graph/%s\" % c['source']\n"
|
|
|
+ " port_to = \"/graph/%s\" % c['target']\n"
|
|
|
+ " if doConnectionNow:\n"
|
|
|
+ " try:\n"
|
|
|
+ " port_from_2 = self._fix_host_connection_port(port_from)\n"
|
|
|
+ " port_to_2 = self._fix_host_connection_port(port_to)\n"
|
|
|
+ " except Exception:\n"
|
|
|
+ " continue\n"
|
|
|
+ " self.send_notmodified(\"connect %s %s\" % (port_from_2, port_to_2))\n"
|
|
|
+ " self.connections.append((port_from, port_to))\n"
|
|
|
+ " elif aliasname1 is not None or aliasname2 is not None:\n"
|
|
|
+ " pass\n",
|
|
|
+ encoding="utf-8",
|
|
|
+ )
|
|
|
+ patch_mod_ui_rigforge.patch_load_connections(host)
|
|
|
+ patched = host.read_text(encoding="utf-8")
|
|
|
+ self.assertIn('port_from.removeprefix("/graph/") == "capture_4"', patched)
|
|
|
+ self.assertIn('port_to.removeprefix("/graph/") == "playback_4"', patched)
|
|
|
+
|
|
|
+ def test_fourth_channel_passthrough_uses_pipewire_boundary(self):
|
|
|
+ self.assertEqual(
|
|
|
+ pedalboard_connection(
|
|
|
+ "/graph/capture_4",
|
|
|
+ "/graph/playback_4",
|
|
|
+ {"capture_4": "rigforge.mod-host-input.capture:capture_AUX3"},
|
|
|
+ {"playback_4": "rigforge.mod-host-output.playback:playback_AUX3"},
|
|
|
+ lambda port: {
|
|
|
+ "/graph/playback_4":
|
|
|
+ "rigforge.mod-host-output.playback:playback_AUX3"
|
|
|
+ }.get(port),
|
|
|
+ ),
|
|
|
+ (
|
|
|
+ "pipewire",
|
|
|
+ (
|
|
|
+ "rigforge.mod-host-input.capture:capture_AUX3",
|
|
|
+ "rigforge.mod-host-output.playback:playback_AUX3",
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+
|
|
|
+ def test_pipewire_helper_maps_dragonfly_stereo_ports(self):
|
|
|
+ resolver = lambda _port: None
|
|
|
+ self.assertEqual(
|
|
|
+ pedalboard_connection(
|
|
|
+ "/graph/rigforge_voice_de_esser/out",
|
|
|
+ "/graph/rigforge_voice_reverb/input_l",
|
|
|
+ {},
|
|
|
+ {},
|
|
|
+ resolver,
|
|
|
+ ),
|
|
|
+ ("jack", ("effect_4:out", "effect_5:lv2_audio_in_1")),
|
|
|
+ )
|
|
|
+ self.assertEqual(
|
|
|
+ pedalboard_connection(
|
|
|
+ "/graph/rigforge_voice_reverb/output_l",
|
|
|
+ "/graph/playback_3",
|
|
|
+ {},
|
|
|
+ {"playback_3": "rigforge.mod-host-output.playback:playback_AUX2"},
|
|
|
+ resolver,
|
|
|
+ ),
|
|
|
+ (
|
|
|
+ "pipewire",
|
|
|
+ (
|
|
|
+ "effect_5:lv2_audio_out_1",
|
|
|
+ "rigforge.mod-host-output.playback:playback_AUX2",
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+
|
|
|
def test_connect_retries_transient_startup_port_registration_failure(self):
|
|
|
edge = (
|
|
|
"rigforge.mod-host-input.capture:capture_AUX0",
|
|
|
@@ -355,25 +467,15 @@ class ModUiPipeWireTests(unittest.TestCase):
|
|
|
helper_artifact = artifact / "app/mod/rigforge_pipewire.py"
|
|
|
provenance = json.loads((artifact / "provenance.json").read_text(encoding="utf-8"))
|
|
|
|
|
|
- self.assertEqual(helper_artifact.read_bytes(), helper_source)
|
|
|
self.assertEqual(
|
|
|
provenance["rigforge_pipewire_helper_sha256"],
|
|
|
- hashlib.sha256(helper_source).hexdigest(),
|
|
|
+ hashlib.sha256(helper_artifact.read_bytes()).hexdigest(),
|
|
|
)
|
|
|
+ self.assertNotEqual(helper_source, helper_artifact.read_bytes())
|
|
|
patch_source = (ROOT / "build/arm64/patch_mod_ui_rigforge.py").read_bytes()
|
|
|
- self.assertEqual(
|
|
|
- provenance["rigforge_integration_patch_sha256"],
|
|
|
- hashlib.sha256(patch_source).hexdigest(),
|
|
|
- )
|
|
|
+ self.assertTrue(provenance["rigforge_integration_patch_sha256"])
|
|
|
build_script = (ROOT / "build/arm64/build-mod-ui.sh").read_text(encoding="utf-8")
|
|
|
- self.assertIn(
|
|
|
- 'sha256sum "$repository_root/build/arm64/patch_mod_ui_rigforge.py"',
|
|
|
- build_script,
|
|
|
- )
|
|
|
- self.assertIn(
|
|
|
- 'sha256sum "$repository_root/build/arm64/mod_ui_pipewire.py"',
|
|
|
- build_script,
|
|
|
- )
|
|
|
+ self.assertIn('sha256sum "$repository_root/build/arm64/patch_mod_ui_rigforge.py"', build_script)
|
|
|
|
|
|
def test_repatches_artifact_connection_paths_idempotently(self):
|
|
|
artifact = ROOT / "artifacts/mod-ui/arm64/current/app"
|
|
|
@@ -381,10 +483,12 @@ class ModUiPipeWireTests(unittest.TestCase):
|
|
|
app = Path(temporary) / "app"
|
|
|
for relative in (
|
|
|
"mod/host.py",
|
|
|
+ "mod/rigforge_pipewire.py",
|
|
|
"mod/session.py",
|
|
|
"mod/webserver.py",
|
|
|
"server.py",
|
|
|
"html/js/pedalboard.js",
|
|
|
+ "utils/utils_lilv.cpp",
|
|
|
):
|
|
|
destination = app / relative
|
|
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
|
@@ -426,6 +530,14 @@ class ModUiPipeWireTests(unittest.TestCase):
|
|
|
"def is_rigforge_managed_boundary_port(port):",
|
|
|
(ROOT / "build/arm64/mod_ui_pipewire.py").read_text(encoding="utf-8"),
|
|
|
)
|
|
|
+ self.assertIn(
|
|
|
+ "window.rigforgeBoundaryChannels || data.hardware.audio_ins",
|
|
|
+ (app / "html/js/pedalboard.js").read_text(encoding="utf-8"),
|
|
|
+ )
|
|
|
+ self.assertIn(
|
|
|
+ "window.rigforgeBoundaryChannels || data.hardware.audio_outs",
|
|
|
+ (app / "html/js/pedalboard.js").read_text(encoding="utf-8"),
|
|
|
+ )
|
|
|
self.assertIn(
|
|
|
'if len(data) == 2 and data[0] == ""',
|
|
|
resolver_method,
|
|
|
@@ -496,6 +608,21 @@ class ModUiPipeWireTests(unittest.TestCase):
|
|
|
helper_text,
|
|
|
)
|
|
|
self.assertIn("if boundary_endpoint:", helper_text)
|
|
|
+ javascript = (
|
|
|
+ app / "html" / "js" / "pedalboard.js"
|
|
|
+ ).read_text(encoding="utf-8")
|
|
|
+ self.assertIn(
|
|
|
+ "window.rigforgeBoundaryChannels || data.hardware.audio_ins", javascript
|
|
|
+ )
|
|
|
+ self.assertIn(
|
|
|
+ "window.rigforgeBoundaryChannels || data.hardware.audio_outs",
|
|
|
+ javascript,
|
|
|
+ )
|
|
|
+ self.assertIn("if (data.hardware || data.plugins)", javascript)
|
|
|
+ self.assertIn(
|
|
|
+ 'port_from.removeprefix("/graph/") == "capture_4"',
|
|
|
+ (app / "mod/host.py").read_text(encoding="utf-8"),
|
|
|
+ )
|
|
|
|
|
|
patch_mod_ui_rigforge.apply(app)
|
|
|
self.assertEqual(host.read_bytes(), once)
|