Johan Le Baut 35 minut temu
rodzic
commit
5a7cbdfa6a

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+__pycache__/
+*.py[cod]

+ 33 - 0
README.md

@@ -29,6 +29,7 @@ This records the preparation already performed on `rigforge` and is a starting p
 ## Repository layout
 
 - `config/desired-state.yaml`: versioned desired audio topology and provisional target mapping.
+- `config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf`: candidate four-channel input to mono direct mixer; not yet installed or run on the target.
 - `config/sooperlooper/fcb1010.slb`: supplied FCB1010 binding file, pending on-target verification.
 - `build/sooperlooper/`: reserved for the later ARM64 Docker build definition.
 - `scripts/validate_desired_state.py`: validates topology and routing invariants without changing the target.
@@ -55,6 +56,38 @@ python3 scripts/observe_pipewire.py
 
 The observer reads `pw-link -l` and compares only connections whose endpoints are explicitly listed under `routing.managed_ports`; expected edges go in `routing.managed_links`. Both lists are empty at this stage, so it intentionally reports no project mismatches. The existing WirePlumber links between UMC AUX ports and their split monitor ports are not classified as project-managed. Only concrete UMC ALSA AUX port names are accepted; logical nodes such as `direct_mix` are rejected until an actual PipeWire node/port exists. The observer only prints missing or unexpected link proposals; it never creates or deletes links. No polling or automatic repair is enabled in this increment.
 
+## 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 a conservative initial gain of 0.2 per input. It is a candidate config for a two-input listening test using `capture_AUX0` and `capture_AUX2`; it is not installed, loaded, or claimed to be syntactically validated by PipeWire yet. Inputs 2 and 4 are provisioned for later checks, not confirmed by instrument tests.
+
+The installed PipeWire example explicitly 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. After this candidate is available in the target checkout, it can be tested as a reversible user-level fragment, without editing `/etc` or the packaged config:
+
+```sh
+target="$HOME/.config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf"
+backup="$target.before-rigforge-test"
+mkdir -p "$(dirname "$target")"
+if test -e "$target"; then
+    cp -a "$target" "$backup"
+fi
+install -m 0644 config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf "$target"
+systemctl --user restart filter-chain.service
+```
+
+Then confirm `filter-chain.service` is active, inspect `pw-cli ls Node`, `pw-link -o`, and `pw-link -i`, and stop if the two project nodes do not appear or the service reports an error. Do not infer the new port names: use the exact names printed by PipeWire. At low monitor volume, connect only the physical capture ports for inputs 1 and 3 to the matching mixer inputs, and the mixer output to `playback_AUX0`; listen for guitar and microphone, then remove these test links with `pw-link -d` using the exact observed endpoint names. Existing WirePlumber hardware links must be left alone.
+
+Rollback the fragment and reload the filter service after the test:
+
+```sh
+if test -e "$backup"; then
+    mv "$backup" "$target"
+else
+    rm -f "$target"
+fi
+systemctl --user restart filter-chain.service
+```
+
+This restarts only `filter-chain.service`, not the main PipeWire daemon; it has not yet been exercised with this project fragment. If activation or sound behaves unexpectedly, first remove the test links, perform the rollback, verify the filter service is active, and do not repeatedly restart it. The repository tests check channel/gain declarations, not PipeWire's native config parser or target runtime behavior.
+
 ## Development PC
 
 The development host is Ubuntu AMD64 with Docker. The SooperLooper source under evaluation is <https://github.com/abarker/sooperlooper-mods>. The Docker build procedure is intentionally not yet provided: first select a tag and inspect that tag's build instructions and licensing. The eventual build command must take an explicit tag, resolve and record its exact commit, build for ARM64, and record artifact architecture, runtime dependencies, provenance, and checksum. The container is for building only; SooperLooper will run natively on the Raspberry Pi.

+ 8 - 0
config/desired-state.yaml

@@ -89,6 +89,14 @@ routing:
   mix:
     id: direct_mix
     channel: mono
+    candidate_implementation: pipewire-filter-chain
+    candidate_config: >-
+      config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf
+    candidate_input_gains:
+      guitar: 0.2
+      bass: 0.2
+      voice: 0.2
+      synth: 0.2
     includes:
       - guitar
       - bass

+ 38 - 0
config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf

@@ -0,0 +1,38 @@
+context.modules = [
+    { name = libpipewire-module-filter-chain
+        args = {
+            node.description = "Rigforge direct input mix"
+            media.name       = "Rigforge direct input mix"
+            filter.graph = {
+                nodes = [
+                    {
+                        name    = mix
+                        type    = builtin
+                        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" ]
+                outputs = [ "mix:Out" ]
+            }
+            capture.props = {
+                node.name         = "rigforge.direct-mix.input"
+                audio.position    = [ AUX0 AUX1 AUX2 AUX3 ]
+                stream.dont-remix = true
+                media.class       = "Audio/Sink"
+            }
+            playback.props = {
+                node.name         = "rigforge.direct-mix.output"
+                audio.position    = [ FL ]
+                stream.dont-remix = true
+                node.passive      = true
+                media.class       = "Audio/Source"
+            }
+        }
+    }
+]

+ 31 - 0
tests/test_filter_chain_config.py

@@ -0,0 +1,31 @@
+import re
+import unittest
+from pathlib import Path
+
+
+ROOT = Path(__file__).resolve().parents[1]
+CONFIG = ROOT / "config" / "pipewire" / "filter-chain.conf.d" / "rigforge-direct-mix.conf"
+
+
+class DirectMixConfigTests(unittest.TestCase):
+    def test_declares_four_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), [
+            '"Gain 1" = 0.2',
+            '"Gain 2" = 0.2',
+            '"Gain 3" = 0.2',
+            '"Gain 4" = 0.2',
+        ])
+        self.assertIn('inputs  = [ "mix:In 1" "mix:In 2" "mix:In 3" "mix:In 4" ]', config)
+        self.assertIn('outputs = [ "mix:Out" ]', config)
+        self.assertIn('audio.position    = [ AUX0 AUX1 AUX2 AUX3 ]', config)
+        self.assertIn('audio.position    = [ FL ]', config)
+
+    def test_uses_project_specific_node_names(self):
+        config = CONFIG.read_text(encoding="utf-8")
+        self.assertIn('node.name         = "rigforge.direct-mix.input"', config)
+        self.assertIn('node.name         = "rigforge.direct-mix.output"', config)
+
+
+if __name__ == "__main__":
+    unittest.main()