Johan Le Baut 1 неделя назад
Родитель
Сommit
55a7be425b

+ 7 - 5
README.md

@@ -31,7 +31,7 @@ This records the preparation already performed on `rigforge` and is a starting p
 
 - `config/desired-state.yaml`: versioned desired audio topology and provisional target mapping.
 - `config/midi-bindings.yaml`: MIDI event-to-action mapping for the general MIDI bridge; SooperLooper bindings remain in their native `.slb` file.
-- `config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf`: tested filter-chain node configuration for the four-input mono direct mixer.
+- `config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf`: eight-input mono mixer configuration, with four direct-source slots and four SooperLooper return slots.
 - `config/sooperlooper/fcb1010.slb`: supplied FCB1010 binding file, pending on-target verification.
 - `build/arm64/`: shared ARM64 build image and task scripts for SooperLooper and mod-host.
 - `scripts/validate_desired_state.py`: validates topology and routing invariants without changing the target.
@@ -72,7 +72,7 @@ On 2026-11-18, the target owner deliberately removed the managed AUX2 capture-to
 
 ## Candidate direct mix test
 
-`config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf` defines a PipeWire builtin mixer with four mono inputs, a single mono output, and an initial gain of 0.2 per input. It was loaded on `rigforge`; its input and output nodes appeared in the graph. Manual links from capture AUX0 and AUX2 through mixer input ports AUX0 and AUX2 to playback AUX0 produced audible guitar and microphone together. Inputs 2 and 4 are provisioned but remain untested with instruments.
+`config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf` defines a PipeWire builtin mixer with eight mono inputs, a single mono output, and an initial gain of 0.2 per input. The original four-input fragment was loaded on `rigforge`; its input and output nodes appeared in the graph. Manual links from capture AUX0 and AUX2 through mixer input ports AUX0 and AUX2 to playback AUX0 produced audible guitar and microphone together. Inputs 2 and 4 remain untested with instruments.
 
 The installed PipeWire example documents loading fragments from `~/.config/pipewire/filter-chain.conf.d/` with `pipewire -c filter-chain.conf`, which is the command used by the current user service. The fragment was installed and tested in that user configuration without editing `/etc` or the packaged config:
 
@@ -138,7 +138,7 @@ systemctl --user status rigforge-sooperlooper.service
 journalctl -f _SYSTEMD_USER_UNIT=rigforge-sooperlooper.service
 ```
 
-Install requires the built ARM64 artifact, the tracked `.slb` file, and target runtime dependencies including `oscsend` from `liblo-tools`. The helper preserves any prior unit file and refuses to overwrite or remove locally edited managed units. It does not use `sudo` or restart PipeWire/WirePlumber. The service has not yet been installed or runtime-tested on the target.
+Install requires the built ARM64 artifact, the tracked `.slb` file, and target runtime dependencies including `oscsend` from `liblo-tools`. The helper preserves any prior unit file and refuses to overwrite or remove locally edited managed units. It does not use `sudo` or restart PipeWire/WirePlumber. The owner reports that the service is installed on `rigforge`; OSC behavior, FCB control, and audio routing still need target verification.
 
 Remove the service with `./scripts/deploy.sh uninstall sooperlooper`.
 
@@ -227,13 +227,15 @@ The graph-wide `rigforge-pipewire-reconcile.timer` was subsequently enabled on t
 
 A PipeWire restart on the same date propagated to mod-host through `PartOf=`, but the first mod-host launch failed with `no jack playback ports`. A later systemd retry started mod-host and configured the NAM/IR chain; subsequent reconciliation runs were clean. This demonstrates eventual recovery with a startup race and an audio interruption. `scripts/wait_mod_host_ports.py` has since been added locally to wait for hardware/mixer ports before launching mod-host; that guard is not yet deployed or target-verified.
 
+On 2026-11-20, the direct mixer was expanded from four to eight mono inputs on the target, retaining AUX0–AUX3 for direct sources and adding AUX4–AUX7 for SooperLooper returns, all initially at gain 0.2. The target's observed ports confirmed the post-IR guitar branch into `sooperlooper:loop0_in_1`, capture AUX1–AUX3 into looper inputs 2–4, and the four `loop0_out` channels returning to mixer AUX4–AUX7. The direct post-IR guitar-to-AUX0 path remains connected. One-shot reconciliation completed with no remaining graph differences. This verifies links exist, not audible loop recording/playback or headroom with summed returns.
+
 The remaining target checks are:
 
 1. The read-only observer and one-shot repair have been tested on `rigforge`. Repairing one missing link restored the audible microphone path; after a later filter-chain service restart, reconciliation requested all three missing links and the observer reported no differences. The observer now also tracks the three guitar NAM/cabinet links. Do not run one-shot reconciliation against an older checkout: it could restore the dry guitar bypass.
-2. Later, test inputs 2 and 4 with sources when available; they are included in the mixer but not verified with instruments.
+2. Test direct mixer inputs 2 and 4 with sources when available; their direct-to-mix routes remain unverified. Looper capture inputs 2–4 are now linked but have not been tested with instruments.
 3. Measure sustained stability and headroom at 48 kHz / 128 frames with all active sources; the current `ERR = 0` observation was brief.
 4. Re-test mod-host startup after installing the new port-readiness guard, then verify reboot with lingering enabled, startup resource limits, and recovery when an LV2 plugin fails to load.
-5. The owner has manually verified FCB notes 6–9 switching the guitar NAM models through the bridge, with near-instant reported transitions. The `midi-bridge` and `sooperlooper` user services are now installable locally; still install and verify unattended startup and UMC unplug/replug recovery on the target. Verify SooperLooper OSC startup, the supplied FCB1010 bindings, audio routing, and the effect and persistence of `discrete_prefader 0` separately.
+5. The owner has manually verified FCB notes 6–9 switching the guitar NAM models through the bridge, with near-instant reported transitions. The `midi-bridge` and `sooperlooper` services are installable locally, and the owner reports SooperLooper is installed on `rigforge`. Verify unattended startup and UMC unplug/replug recovery, SooperLooper OSC startup, the supplied FCB1010 bindings, audio routing, and the effect and persistence of `discrete_prefader 0` separately.
 
 Do not treat planned packages, commands, ports, or service settings as target-validated until these checks have been performed.
 

+ 45 - 1
config/desired-state.yaml

@@ -175,6 +175,10 @@ routing:
       bass: 0.2
       voice: 0.2
       synth: 0.2
+      looper_return_1: 0.2
+      looper_return_2: 0.2
+      looper_return_3: 0.2
+      looper_return_4: 0.2
     includes:
       - guitar
       - bass
@@ -224,13 +228,29 @@ routing:
     feed_looper_inputs: false
   managed_ports:
     - alsa_input.hw_U192k_0:capture_AUX0
+    - alsa_input.hw_U192k_0:capture_AUX1
+    - alsa_input.hw_U192k_0:capture_AUX2
+    - alsa_input.hw_U192k_0:capture_AUX3
     - effect_0:input
     - effect_0:output
     - effect_1:in
     - effect_1:out
+    - sooperlooper:loop0_in_1
+    - sooperlooper:loop0_in_2
+    - sooperlooper:loop0_in_3
+    - sooperlooper:loop0_in_4
+    - sooperlooper:loop0_out_1
+    - sooperlooper:loop0_out_2
+    - sooperlooper:loop0_out_3
+    - sooperlooper:loop0_out_4
     - rigforge.direct-mix.input:playback_AUX0
-    - alsa_input.hw_U192k_0:capture_AUX2
+    - rigforge.direct-mix.input:playback_AUX1
     - rigforge.direct-mix.input:playback_AUX2
+    - rigforge.direct-mix.input:playback_AUX3
+    - rigforge.direct-mix.input:playback_AUX4
+    - rigforge.direct-mix.input:playback_AUX5
+    - rigforge.direct-mix.input:playback_AUX6
+    - rigforge.direct-mix.input:playback_AUX7
     - rigforge.direct-mix.output:capture_FL
     - alsa_output.hw_U192k_0:playback_AUX0
   managed_links:
@@ -243,9 +263,33 @@ routing:
     - from: effect_1:out
       to: rigforge.direct-mix.input:playback_AUX0
       status: observed
+    - from: effect_1:out
+      to: sooperlooper:loop0_in_1
+      status: observed
+    - from: alsa_input.hw_U192k_0:capture_AUX1
+      to: sooperlooper:loop0_in_2
+      status: observed
     - from: alsa_input.hw_U192k_0:capture_AUX2
       to: rigforge.direct-mix.input:playback_AUX2
       status: observed
+    - from: alsa_input.hw_U192k_0:capture_AUX2
+      to: sooperlooper:loop0_in_3
+      status: observed
+    - from: alsa_input.hw_U192k_0:capture_AUX3
+      to: sooperlooper:loop0_in_4
+      status: observed
+    - from: sooperlooper:loop0_out_1
+      to: rigforge.direct-mix.input:playback_AUX4
+      status: observed
+    - from: sooperlooper:loop0_out_2
+      to: rigforge.direct-mix.input:playback_AUX5
+      status: observed
+    - from: sooperlooper:loop0_out_3
+      to: rigforge.direct-mix.input:playback_AUX6
+      status: observed
+    - from: sooperlooper:loop0_out_4
+      to: rigforge.direct-mix.input:playback_AUX7
+      status: observed
     - from: rigforge.direct-mix.output:capture_FL
       to: alsa_output.hw_U192k_0:playback_AUX0
       status: observed

+ 12 - 8
config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf

@@ -11,18 +11,22 @@ context.modules = [
                         label   = mixer
                         control = {
                             "Gain 1" = 0.2
-                            "Gain 2" = 0.2
-                            "Gain 3" = 0.2
-                            "Gain 4" = 0.2
-                        }
-                    }
-                ]
-                inputs  = [ "mix:In 1" "mix:In 2" "mix:In 3" "mix:In 4" ]
+                             "Gain 2" = 0.2
+                             "Gain 3" = 0.2
+                             "Gain 4" = 0.2
+                             "Gain 5" = 0.2
+                             "Gain 6" = 0.2
+                             "Gain 7" = 0.2
+                             "Gain 8" = 0.2
+                         }
+                     }
+                 ]
+                inputs  = [ "mix:In 1" "mix:In 2" "mix:In 3" "mix:In 4" "mix:In 5" "mix:In 6" "mix:In 7" "mix:In 8" ]
                 outputs = [ "mix:Out" ]
             }
             capture.props = {
                 node.name         = "rigforge.direct-mix.input"
-                audio.position    = [ AUX0 AUX1 AUX2 AUX3 ]
+                audio.position    = [ AUX0 AUX1 AUX2 AUX3 AUX4 AUX5 AUX6 AUX7 ]
                 stream.dont-remix = true
                 media.class       = "Audio/Sink"
             }

+ 3 - 2
scripts/observe_pipewire.py

@@ -14,10 +14,11 @@ MANAGED_ENDPOINT_PATTERN = re.compile(
     r"^(?:"
     r"alsa_input\.hw_U192k_0:capture_AUX[0-3]|"
     r"alsa_output\.hw_U192k_0:playback_AUX[0-3]|"
-    r"rigforge\.direct-mix\.input:playback_AUX[0-3]|"
+    r"rigforge\.direct-mix\.input:playback_AUX[0-7]|"
     r"rigforge\.direct-mix\.output:capture_FL|"
     r"effect_0:(?:input|output)|"
-    r"effect_1:(?:in|out)"
+    r"effect_1:(?:in|out)|"
+    r"sooperlooper:loop0_(?:in|out)_[1-4]"
     r")$"
 )
 

+ 12 - 4
tests/test_filter_chain_config.py

@@ -8,17 +8,25 @@ CONFIG = ROOT / "config" / "pipewire" / "filter-chain.conf.d" / "rigforge-direct
 
 
 class DirectMixConfigTests(unittest.TestCase):
-    def test_declares_four_independent_mono_inputs_and_one_output(self):
+    def test_declares_eight_independent_mono_inputs_and_one_output(self):
         config = CONFIG.read_text(encoding="utf-8")
-        self.assertEqual(re.findall(r'"Gain [1-4]" = 0\.2', config), [
+        self.assertEqual(re.findall(r'"Gain [1-8]" = 0\.2', config), [
             '"Gain 1" = 0.2',
             '"Gain 2" = 0.2',
             '"Gain 3" = 0.2',
             '"Gain 4" = 0.2',
+            '"Gain 5" = 0.2',
+            '"Gain 6" = 0.2',
+            '"Gain 7" = 0.2',
+            '"Gain 8" = 0.2',
         ])
-        self.assertIn('inputs  = [ "mix:In 1" "mix:In 2" "mix:In 3" "mix:In 4" ]', config)
+        self.assertIn(
+            'inputs  = [ "mix:In 1" "mix:In 2" "mix:In 3" "mix:In 4" '
+            '"mix:In 5" "mix:In 6" "mix:In 7" "mix:In 8" ]',
+            config,
+        )
         self.assertIn('outputs = [ "mix:Out" ]', config)
-        self.assertIn('audio.position    = [ AUX0 AUX1 AUX2 AUX3 ]', config)
+        self.assertIn('audio.position    = [ AUX0 AUX1 AUX2 AUX3 AUX4 AUX5 AUX6 AUX7 ]', config)
         self.assertIn('audio.position    = [ FL ]', config)
 
     def test_uses_project_specific_node_names(self):

+ 49 - 1
tests/test_pipewire_observer.py

@@ -20,6 +20,7 @@ from observe_pipewire import (
 )
 
 CAPTURE_0 = "alsa_input.hw_U192k_0:capture_AUX0"
+CAPTURE_1 = "alsa_input.hw_U192k_0:capture_AUX1"
 CAPTURE_2 = "alsa_input.hw_U192k_0:capture_AUX2"
 CAPTURE_3 = "alsa_input.hw_U192k_0:capture_AUX3"
 AMP_INPUT = "effect_0:input"
@@ -28,6 +29,18 @@ CAB_INPUT = "effect_1:in"
 CAB_OUTPUT = "effect_1:out"
 MIX_INPUT_0 = "rigforge.direct-mix.input:playback_AUX0"
 MIX_INPUT_2 = "rigforge.direct-mix.input:playback_AUX2"
+MIX_INPUT_4 = "rigforge.direct-mix.input:playback_AUX4"
+MIX_INPUT_5 = "rigforge.direct-mix.input:playback_AUX5"
+MIX_INPUT_6 = "rigforge.direct-mix.input:playback_AUX6"
+MIX_INPUT_7 = "rigforge.direct-mix.input:playback_AUX7"
+LOOPER_INPUT_1 = "sooperlooper:loop0_in_1"
+LOOPER_INPUT_2 = "sooperlooper:loop0_in_2"
+LOOPER_INPUT_3 = "sooperlooper:loop0_in_3"
+LOOPER_INPUT_4 = "sooperlooper:loop0_in_4"
+LOOPER_OUTPUT_1 = "sooperlooper:loop0_out_1"
+LOOPER_OUTPUT_2 = "sooperlooper:loop0_out_2"
+LOOPER_OUTPUT_3 = "sooperlooper:loop0_out_3"
+LOOPER_OUTPUT_4 = "sooperlooper:loop0_out_4"
 MIX_OUTPUT = "rigforge.direct-mix.output:capture_FL"
 PLAYBACK_0 = "alsa_output.hw_U192k_0:playback_AUX0"
 
@@ -35,7 +48,20 @@ PLAYBACK_0 = "alsa_output.hw_U192k_0:playback_AUX0"
 class PipeWireObserverTests(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
-        cls.state = load_state(ROOT / "config" / "desired-state.yaml")
+        cls.desired_state = load_state(ROOT / "config" / "desired-state.yaml")
+        cls.state = copy.deepcopy(cls.desired_state)
+        existing_test_edges = {
+            (CAPTURE_0, AMP_INPUT),
+            (AMP_OUTPUT, CAB_INPUT),
+            (CAB_OUTPUT, MIX_INPUT_0),
+            (CAPTURE_2, MIX_INPUT_2),
+            (MIX_OUTPUT, PLAYBACK_0),
+        }
+        cls.state["routing"]["managed_links"] = [
+            link
+            for link in cls.state["routing"]["managed_links"]
+            if (link["from"], link["to"]) in existing_test_edges
+        ]
 
     def test_empty_managed_set_ignores_wireplumber_hardware_links(self):
         state = copy.deepcopy(self.state)
@@ -116,6 +142,28 @@ class PipeWireObserverTests(unittest.TestCase):
         self.assertEqual(validate_managed_links(self.state), [])
         self.assertEqual(observe(self.state, links), [])
 
+    def test_desired_graph_keeps_direct_guitar_and_routes_looper_channels_through_mix(self):
+        links = {
+            (link["from"], link["to"])
+            for link in self.desired_state["routing"]["managed_links"]
+        }
+        self.assertIn((CAB_OUTPUT, MIX_INPUT_0), links)
+        self.assertIn((CAB_OUTPUT, LOOPER_INPUT_1), links)
+        self.assertIn((CAPTURE_1, LOOPER_INPUT_2), links)
+        self.assertIn((CAPTURE_2, LOOPER_INPUT_3), links)
+        self.assertIn((CAPTURE_3, LOOPER_INPUT_4), links)
+        self.assertTrue(
+            {
+                (LOOPER_OUTPUT_1, MIX_INPUT_4),
+                (LOOPER_OUTPUT_2, MIX_INPUT_5),
+                (LOOPER_OUTPUT_3, MIX_INPUT_6),
+                (LOOPER_OUTPUT_4, MIX_INPUT_7),
+            }
+            <= links
+        )
+        self.assertEqual(validate_managed_links(self.desired_state), [])
+        self.assertEqual(observe(self.desired_state, links), [])
+
     def test_reports_missing_voice_mix_link_without_expectation_of_dry_guitar(self):
         links = {
             (CAPTURE_0, AMP_INPUT),