From 8add95df3f52b2cb3a7bed679f3b28bf48801d47 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Fri, 16 Oct 2026 19:38:59 +0200 Subject: [PATCH] docs: refresh all guides and regenerate mixer screenshots Bring README, architecture, backlog, checklist, steward baseline, and every docs guide up to date. Document unnamed spacers, current setup/save/restart behavior, MIDI feedback and portable builds. Replace both screenshots with current representative layouts and fixed cell-grid SVG text/border rendering. Validation PASS: local file links across all 12 Markdown documents; both SVGs parsed and visually inspected after rsvg-convert; repeated doc_screenshots generation produced identical SHA-256 hashes; git diff --check; cargo fmt --all -- --check; cargo check --workspace --all-targets --all-features; cargo clippy --workspace --all-targets --all-features -- -D warnings; canonical architecture-profile schema test; portable no-default-feature package check. Full workspace gates passed in preceding empty-separator implementation commit. --- AGENTS.md | 2 +- README.md | 26 +- architecture.md | 22 +- checklist.md | 37 +- docs/README.md | 25 +- docs/build.md | 25 +- docs/ci-coverage.md | 6 + docs/configuration.md | 31 + docs/images/mixer-horizontal.svg | 2126 +++++++++++++---- docs/images/mixer-vertical.svg | 3683 ++++++++++++++++++++++++++++-- docs/midi-identity.md | 16 +- docs/pulse-daemon-fixture.md | 6 + docs/related-projects.md | 6 + task.md | 13 +- tui/examples/doc_screenshots.rs | 190 +- 15 files changed, 5567 insertions(+), 647 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b0ff399..b86f4af 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -43,4 +43,4 @@ cargo build --workspace --release --all-features Also test the default build, no-default-features build, and each optional backend independently once feature flags exist. Provision native development libraries in CI. Hardware-free domain, fake-adapter, config, and TUI tests must run without an audio daemon or USB device. Keep real audio/hardware checks separately opt-in and document their fixtures and prerequisites. Add property tests for numerical conversions and state invariants; use a fake clock for retries and coalescing. Test observable behavior, including failure paths, rather than private implementation details. -Current baseline: Rust 1.88.0 is pinned, domain/config crate boundaries exist, and M1 domain contracts are implemented. Runtime adapters, configuration, and the executable remain scaffold work. The `implementation-start` tag marks the original CI coverage/badge baseline. M0.2 awaits real Jenkins verification; the next implementation milestone is M2 in `task.md`. +Current baseline (2026-10-16): Rust 1.88.0 is pinned. Native MIDI/Pulse workers, live IPC/TUI, managed profiles, MIDI learn/feedback, and persisted mixer editing are implemented. The `implementation-start` tag marks the original CI coverage/badge baseline. Follow unchecked acceptance criteria in `task.md`; do not restart completed foundation work. M0.2 still awaits provisioned Linux Jenkins verification, and native PipeWire and runtime relative groups remain unfinished. Keep save/reload/server-restart coverage for layout order and preserve user-edited example profiles. diff --git a/README.md b/README.md index 884bd02..e9c08bb 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,9 @@ output, while the terminal UI remains useful as a complete software mixer. ![Horizontal mixer showing application, group, and output faders](docs/images/mixer-horizontal.svg) -The horizontal layout puts conventional bottom-up faders side by side. The -same profile can switch to a compact stacked layout for narrow terminals: +The horizontal layout puts bottom-up faders side by side, with dividers and +flexible spacers between sections. Switch to Vertical in Config for stacked +cards, including one-row Slim and Bordered slim faders: ![Vertical mixer showing stacked faders and separators](docs/images/mixer-vertical.svg) @@ -24,10 +25,14 @@ same profile can switch to a compact stacked layout for narrow terminals: - Learn volume and mute controls from MIDI, reflect confirmed mute state on control-surface LEDs, use pickup to prevent jumps, and keep independently identified controllers from colliding. -- Arrange faders and named separators directly in the mixer. Choose Slim, +- Arrange faders, separators, and empty spacers directly in the mixer. Choose Slim, Bordered slim, Standard, or Thick faders, and hide detail faders behind a group when useful. +- Size separators independently and choose Plain, Line, Double line, or Box. + Fill separators share spare space; names are optional. - Use horizontal or vertical layouts and six built-in terminal themes. +- Choose Detailed, Compact, Symbol, Color, or Hidden pickup feedback in Config. + Hiding the indicator keeps pickup protection active. - Run as one command, or keep a standalone server alive while reconnecting TUI clients come and go. - Edit a validated draft from the TUI and persist it with one explicit Save. @@ -47,8 +52,13 @@ cargo run --locked -p fader_master -- \ ``` The combined executable connects to an existing per-user server when possible -and starts an embedded one otherwise. Running without `--config` creates a -safe empty `default` profile on first use, which can then be edited in the TUI. +and starts an embedded one otherwise. Running without `--config` creates +a `default` profile with a Master-output fader. A sole detected MIDI input is +adopted as the default controller; otherwise choose a detected input in Config, +add it, and Save. Edit the Master fader with `E` to learn volume and mute controls. + +The screenshots use reproducible example state rendered by the actual TUI; +they do not represent a live hardware session. ## Everyday controls @@ -67,6 +77,12 @@ Use `Tab` to open Config, `T` to cycle the theme, and `Q` to open the quit confirmation. Fader editing exposes capture rules, group membership, separate controller/Learn/Unlearn actions for volume and mute, size, and visibility. Config → Active profile opens the profile switcher. +Separator editing offers an optional name, size, and decoration; an empty +name with Plain + Fill creates flexible blank space. Press Enter to accept +popup edits, then use Config → Save to persist the draft. + +After updating the binaries, restart the server as well as the client. The +combined launcher reuses an already-running server. ## Documentation diff --git a/architecture.md b/architecture.md index ae20917..4aec5e9 100644 --- a/architecture.md +++ b/architecture.md @@ -1,12 +1,17 @@ # fader_master architecture -Status: design researched 2026-10-05; foundation and the M1–M3 hardware-free -domain, persistence, reducer, bounded dispatch, fake-adapter, and lifecycle -milestones are implemented. The executable launches an interactive Ratatui mixer -shell backed by explicitly labeled demo state. Native workers, live TUI state, -and native adapters below are planned, not shipped. +Status as of 2026-10-16: the Linux server runs native MIDI and Pulse-compatible +audio workers, a reconnecting live TUI, managed profiles, MIDI learn and mute +feedback, and a persisted mixer/configuration editor. The combined launcher +starts a server only when none is available. Layouts include horizontal strips, +stacked faders, configurable separators/spacers, themes, and pickup indicators. +Native PipeWire, runtime relative groups, and the unchecked acceptance work in +`task.md` remain unfinished. -## Implemented boundary at M2 entry +## Foundation and implementation history + +The following foundation notes describe the original milestone boundaries; +the runtime and UI contracts later in this document describe the current system. Rust 1.88.0 is the pinned toolchain and tested MSRV. The workspace inherits package metadata, including the existing custom `LICENSE` through `license-file`. @@ -535,8 +540,9 @@ chosen as members. Absolute remains the only selectable group mode until the reserved relative-mode runtime work is complete. The secondary Config tab is not an alternative object editor. It presents -profile theme selection, a popup listing all hidden faders for individual -restoration, unsaved and Save state, active profile/backend status, MIDI-learn +profile theme, mixer orientation and pickup-status selection, a popup listing +all hidden faders for individual restoration, unsaved and Save state, active +profile/backend status, MIDI-learn cancellation, and MIDI device diagnostics. Object and layout edits stay on the main mixer. There is no separate hidden-fader mode: hidden rows disappear from the mixer and are restored from this popup at their retained layout positions. diff --git a/checklist.md b/checklist.md index 4729833..64a8794 100644 --- a/checklist.md +++ b/checklist.md @@ -1,8 +1,9 @@ # fader_master hands-on checklist (Arch + PipeWire) Automated tests cover validation, buffering, IPC, rollback, rendering, and -atomic persistence. This checklist is only for behavior requiring your real -PipeWire session, APC MINI, applications, and terminal. +atomic persistence. This checklist records manual acceptance with your real +PipeWire session, APC MINI, applications, and terminal. Existing checked items +are historical observations; the new unchecked items still need manual testing. ## Setup @@ -10,8 +11,7 @@ Use a disposable profile directory so editor Save does not modify tracked examples: ```sh -work=/tmp/fader-master-check -mkdir -p "$work" +work=$(mktemp -d /tmp/fader-master-check.XXXXXX) cp examples/profiles/{arch-pipewire,desktop}.toml "$work/" cargo run --locked -p fader_master -- serve \ --config "$work/arch-pipewire.toml" --audio pulse @@ -23,6 +23,9 @@ In another terminal: cargo run --locked -p fader_master -- tui ``` +Restart the server too after rebuilding. A new client or all-in-one launcher +can reconnect to an old server process; it cannot replace its implementation. + Known mappings: Music `CC48/Note64`, Browser `CC49/Note65`, Media sync `CC50/Note66`, and Master `CC56/Note98`. The profile polling interval is 10 ms and accepts 1–100 ms. @@ -72,8 +75,28 @@ cargo run --locked -p fader_master -- profile switch arch-pipewire - [ ] Run `cargo run --locked -p fader_master -- status`; confirm `status=ready` and expected final values. - [ ] Report any pre-pickup jump, wrong target, rough sweep, stale/pending value, - lost mute edge, failed apply/save diagnostic, reconnect over one second, + lost mute edge, failed Save diagnostic, reconnect over one second, terminal corruption, or process exit. -Explicit `profile switch --restore` is automated but remains optional for manual -testing until the MIDI output-feedback milestone is implemented. +Explicit `profile switch --restore` remains optional for manual testing because +it deliberately writes saved state. Mute LED feedback is implemented; verify +the configured on/off values against the particular surface. + +## Layout, settings, and persistence + +- [ ] Move a fader in both directions, Save, restart the server, and move it + again. Verify that selection follows it and the order never snaps back. +- [ ] Add and rename separators with both nonempty and empty names. Create two + unnamed separators and verify they remain independently editable/movable. +- [ ] Try separator Slim/Standard/Thick/Fill and all four decorations in both + orientations. Plain + empty name should be blank space; unnamed lines should + be continuous. Multiple Fill separators should share leftover space. +- [ ] Try Slim, Bordered slim, Standard, and Thick faders. Resize the terminal: + horizontal entries should stay on one row, and selection should stay visible. +- [ ] Change theme, orientation, and each pickup-status mode in Config. Save + and restart; all choices should persist. Hidden pickup status must not disable + the hardware pickup behavior. +- [ ] Hide an application fader used by a group, then restore it from the + Config popup. Verify that its MIDI binding and group membership still work. +- [ ] Relearn a mute button, Save, and confirm only the new button controls it + and receives feedback. Open Help with h/?; Escape closes popups, Q confirms quit. diff --git a/docs/README.md b/docs/README.md index 7762a25..1df2ee3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,6 +10,12 @@ - [Example desktop profile](../examples/profiles/desktop.toml) - [Hands-on functional checklist](../checklist.md) +For everyday layout editing: select a fader or separator and press `E`. +Separators accept empty names, independent size and decoration, and Fill space. +Config contains theme/orientation/pickup display, hidden-fader restoration, +profile switching, MIDI devices, and Save. See the +[mixer presentation reference](configuration.md#mixer-presentation). + ## Design and development - [Architecture and library research](../architecture.md) @@ -23,9 +29,24 @@ - [Related projects and libraries](related-projects.md) -The README screenshots are deterministic renders of the real TUI. Regenerate -them after presentation changes with: +## Screenshot maintenance + +Both README screenshots are deterministic renders of the real TUI using +example state, not captures of a live audio session: + +- [Horizontal mixer](images/mixer-horizontal.svg): five side-by-side faders, + a double divider, an unnamed Fill spacer, mute and group-mixed state. +- [Vertical mixer](images/mixer-vertical.svg): section labels, Standard, + Slim and Bordered slim rows, and the default output. + +Regenerate all screenshots after presentation changes: ```sh cargo run --locked -p tui --example doc_screenshots ``` + +The generator lives in [doc_screenshots.rs](../tui/examples/doc_screenshots.rs). +It places text on the terminal cell grid and draws box/block glyphs to cell +edges so font differences do not break borders or meters. Inspect both SVGs +in a browser or rasterize with `rsvg-convert` for review; confirm every fader, +label and keyboard hint is visible. Do not hand-edit the generated SVG files. diff --git a/docs/build.md b/docs/build.md index ebb8a05..d821f56 100644 --- a/docs/build.md +++ b/docs/build.md @@ -33,13 +33,32 @@ through `pipewire-pulse`; it does not require the standalone PulseAudio server. The Pulse adapter works with PulseAudio and PipeWire's pipewire-pulse compatibility service. MIDI input uses ALSA's sequencer API through `midir`, and Linux identity enrichment uses libudev. PipeWire does not replace the -`alsa-lib` build dependency. A build that deliberately excludes native audio -and MIDI dependencies remains available: +`alsa-lib` build dependency. To exclude native audio and MIDI dependencies, +build the portable library/TUI subset used on FreeBSD and explicitly omit the +Linux executable: ```sh -cargo build --workspace --no-default-features --locked +cargo build --locked --no-default-features \ + -p fader-core -p fader-config -p midi -p volume_lib -p tui ``` +`--workspace --no-default-features` alone is not a native-free build: the +executable's dependencies still enable the native MIDI and Pulse features. + +The normal Linux release build produces all three entry points: + +```sh +cargo build --locked --workspace --release --all-features +./target/release/fader_master +# Or run separately, in two terminals: +./target/release/fader_master_server +./target/release/fader_master_client +``` + +Restart both server and client when upgrading, including an external server +that the all-in-one launcher might reuse. First-run configuration and MIDI +setup are described in [Advanced configuration](configuration.md). + Future native PipeWire and ALSA mixer adapters will add their own feature-gated development packages. The MIDI crate can also be checked without its native transport and identity discovery while retaining byte decoding and routing: diff --git a/docs/ci-coverage.md b/docs/ci-coverage.md index 1bde409..7179d5c 100644 --- a/docs/ci-coverage.md +++ b/docs/ci-coverage.md @@ -1,5 +1,11 @@ # CI coverage and badge lifecycle +See [Build prerequisites](build.md) for the native and portable build commands. +TUI rendering, separator presentation, and configuration round-trip tests are +part of the portable suites. Unix-socket/server-restart tests require the +Linux executable test suite; real audio fixtures remain separately opt-in. +README screenshots are generated documentation assets, not coverage badges. + The generic renderer in `scripts/ci-coverage-badges.sh` is copied unchanged from `Dandaedre/agent-tasks` revision `fb9d8f7d16f100c2d1377f23394a2302eac9ab18`. diff --git a/docs/configuration.md b/docs/configuration.md index 2c01eb4..361c381 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -29,6 +29,10 @@ running outside the normal XDG runtime location. `--theme THEME` is a client session override; changing the theme in the TUI updates the profile draft, and Config → Save persists it. +When connecting to an existing server, its active profile and audio backend +remain authoritative. Restart both processes after a binary update; a new +client cannot update the code inside an already-running server. + ## Managed profiles and files Without `--config`, fader_master uses the XDG layout: @@ -194,6 +198,22 @@ columns, Standard fits the label within 8–18 columns, and Thick uses 22. Fill shares unused viewport space with other Fill separators after faders have been fitted, so it does not force faders off-screen or cause wrapping. +Separator names are optional. Keep a stable nonempty `id`, but use `label = ""` +for an unlabelled rule, box, or spacer: + +```toml +[[mixer_layout]] +kind = "separator" +id = "before-master" +label = "" +size = "fill" +decoration = "plain" +``` + +Size and decoration are independent. An unnamed Line or Double separator +draws an uninterrupted rule; Plain draws only empty space. Reordering keeps +the entry's ID, appearance, and comments, including after Save and restart. + ### MIDI surfaces and bindings Use `fader_master devices` to inspect available ports and durable USB identity @@ -222,6 +242,11 @@ feedback = { kind = "note", channel = 1, number = 64, on = 127, off = 0 } The TUI can choose a controller, learn the next supported movement or button press, and remove an assignment independently for volume and mute. Unassigned actions inherit `[ui].default_controller` for learning. +Learn opens a modal waiting for a movement or button press; Escape cancels it. +Changing controller, learning, and unlearning are separate actions. In Config, +open a MIDI device to see its connection details and set its default-controller +flag. Hidden faders remain bound and continue contributing to groups; restore +them from Config → Show hidden faders. `feedback` is optional and requires the binding's surface to define `output_port`. After that output attaches, the server sends `on` when the @@ -232,6 +257,12 @@ lights an LED as if it succeeded. Reconnect sends the current state again; unchanged states are deduplicated. Both note and CC feedback use 1-based channels and values from 0–127. +LED values are device-specific: a note velocity can mean a color or animation, +so 127 is not a universal “on” value. The APC MINI example uses its configured +green value. Relearning a mute binding moves its feedback assignment to the new +control. Set feedback values and output-port details in the profile when your +surface requires a different protocol. + ## Validation, migration, and Save Validate a file without opening MIDI/audio devices or changing live audio: diff --git a/docs/images/mixer-horizontal.svg b/docs/images/mixer-horizontal.svg index 89ed004..a607d3f 100644 --- a/docs/images/mixer-horizontal.svg +++ b/docs/images/mixer-horizontal.svg @@ -1,397 +1,1737 @@ - + - -╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - -│ - FADER - MASTER - [1 Mixer] [2 Config] · pulse · PipeWire · ready · rev 42 · Catppuccin Mocha -│ - -╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ - -┏ - Live mixer objects -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ - -┃ -│ -┌─────┐ -┌─────┐ -│ -┌─────┐ -│ -┌─────┐ -┃ - - - - - - - - - -┃ -│ -│░░░░░│ -│░░░░░│ -│ -│░░░░░│ -│ -│░░░░░│ -┃ - - - - - - - - - -┃ -│ -│░░░░░│ -│░░░░░│ -│ -│░░░░░│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│░░░░░│ -│ -│░░░░░│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│░░░░░│ -│ -│░░░░░│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│░░░░░│ -│ -│ -█████ -│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│░░░░░│ -│ -│ -█████ -│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│ -█████ -│ -│ -│ -█████ -│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│ -█████ -│ -│ -│ -█████ -│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│ -█████ -│ -│ -│ -█████ -│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│ -█████ -│ -│ -│ -█████ -│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│ -█████ -│ -│ -│ -█████ -│ -│ -│ -█████ -│ -┃ - - - - - - - - - -┃ -│ -│ -█████ -│ -│ -█████ -│ -│ -│ -█████ -│ -│ -│ -█████ -│ -┃ - -┃ -│ -└─────┘ -└─────┘ -│ -└─────┘ -│ -└─────┘ -┃ - -┃ -│ - pickup: tracking pickup: waiting -│ - pickup: mixed -│ - pickup: tracking -┃ - -┃ -│ - LIVE - MUTED -│ - MIXED -│ - LIVE -┃ - -┃ -│ - 78% 46% -│ - 62% -│ - 88% -┃ - - - -┃ - Applications - Music Browser - Groups - Media group - Outputs - Master output -┃ - -┗APC MINI: connected (24:0)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - -╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ - -│ - ←→/jk -select - ↑↓ -volume - M -mute - Home/End -0/100% - T -theme - Tab -config - Q -quit - ⇧←→/⇧JK -move - A/E/D -separator - ⇧H -hide - h/? -help -│ - -╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +F +A +D +E +R +M +A +S +T +E +R +[ +1 +M +i +x +e +r +] +[ +2 +C +o +n +f +i +g +] +· +p +u +l +s +e +· +P +i +p +e +W +i +r +e +· +r +e +a +d +y +· +r +e +v +4 +2 +· +C +a +t +p +p +u +c +c +i +n +M +o +c +h +a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +L +i +v +e +m +i +x +e +r +o +b +j +e +c +t +s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +● +○ +● + +◐ +● + + + +L +I +V +E +L +I +V +E +M +U +T +E +D + +M +I +X +E +D +L +I +V +E + + + +7 +2 +% +3 +8 +% +5 +5 +% + +7 +2 +% +8 +6 +% + + + + + +M +u +s +i +c +B +r +o +w +s +e +r +V +o +i +c +e +c +h +a +t +M +e +d +i +a +g +r +o +u +p +M +a +s +t +e +r +o +u +t +p +u +t + + + +A +P +C +M +I +N +I +: +c +o +n +n +e +c +t +e +d +( +2 +4 +: +0 +) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +← +→ +/ +j +k +s +e +l +e +c +t +↑ +↓ +v +o +l +u +m +e +M +m +u +t +e +H +o +m +e +/ +E +n +d +0 +/ +1 +0 +0 +% +T +t +h +e +m +e +T +a +b +c +o +n +f +i +g +Q +q +u +i +t +⇧ +← +→ +/ +⇧ +J +K +m +o +v +e +A +/ +E +/ +D +s +e +p +a +r +a +t +o +r +⇧ +H +h +i +d +e +h +/ +? +h +e +l +p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/mixer-vertical.svg b/docs/images/mixer-vertical.svg index fd37233..89cb15f 100644 --- a/docs/images/mixer-vertical.svg +++ b/docs/images/mixer-vertical.svg @@ -1,171 +1,3524 @@ - + - -╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - -│ - FADER - MASTER - [1 Mixer] [2 Config] · pulse · PipeWire · ready · rev 42 · Catppuccin Mocha -│ - -╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ - -┏ - Live mixer objects -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ - -┃ -┌────────────────────────────────────────────────────────────────────────────────────────────────────┐ -┃ - -┃ -│ ── Applications ── │ -┃ - -┃ -│ │ -┃ - -┃ -└────────────────────────────────────────────────────────────────────────────────────────────────────┘ -┃ - -┃┌ Music [application · 2 streams] pickup: tracking─────────────────────────────────────────────────┐┃ - - - -┃│ -██████████████████████████████████████████████████████████████████████████████ -│┃ - - - - - -┃│ -████████████████████████████████████████████████ -78% -█████████████████████████ -│┃ - -┃└────────────────────────────────────────────────────────────────────────────────────────────────────┘┃ - - - - - -┃ -█████████████████████████████████████████ - Brow -ser 46% MUTED -┃ - -┃┌────────────────────────────────────────────────────────────────────────────────────────────────────┐┃ - -┃│ ── Groups ── │┃ - -┃│ │┃ - -┃└────────────────────────────────────────────────────────────────────────────────────────────────────┘┃ - -┃┌ Media group [group · Music + Browser] pickup: mixed──────────────────────────────────────────────┐┃ - - - -┃│ -██████████████████████████████████████████████████████████████ -│┃ - - - -┃│ -██████████████████████████████████████████████████████████████ -│┃ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +F +A +D +E +R +M +A +S +T +E +R +[ +1 +M +i +x +e +r +] +[ +2 +C +o +n +f +i +g +] +· +p +u +l +s +e +· +P +i +p +e +W +i +r +e +· +r +e +a +d +y +· +r +e +v +4 +2 +· +C +a +t +p +p +u +c +c +i +n +M +o +c +h +a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +L +i +v +e +m +i +x +e +r +o +b +j +e +c +t +s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +A +p +p +l +i +c +a +t +i +o +n +s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +M +u +s +i +c +[ +a +p +p +l +i +c +a +t +i +o +n +· +2 +s +t +r +e +a +m +s +] +● + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +7 +2 +% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +B +r +o +w +s +e +r +3 +8 +% + + + + +V +o +i +c +e +c +h +a +t +[ +a +p +p +l +i +c +a +t +i +o +n +· +2 +s +t +r +e +a +m +s +] +● + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +5 +5 +% +M +U +T +E +D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +G +r +o +u +p +s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +M +e +d +i +a +g +r +o +u +p +[ +g +r +o +u +p +· +M +u +s +i +c ++ +B +r +o +w +s +e +r +] +◐ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +7 +2 +% +M +I +X +E +D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +O +u +t +p +u +t +s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +M +a +s +t +e +r +o +u +t +p +u +t +[ +o +u +t +p +u +t +· +B +u +i +l +t +- +i +n +A +u +d +i +o +A +n +a +l +o +g +S +t +e +r +e +o +] +● + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - -┃│ -█████████████████████████████████████████████ -62% MIXED -███████ -│┃ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - -┃│ -██████████████████████████████████████████████████████████████ -│┃ - -┃└────────────────────────────────────────────────────────────────────────────────────────────────────┘┃ - -┃┌────────────────────────────────────────────────────────────────────────────────────────────────────┐┃ - -┃│ ── Outputs ── │┃ - -┃│ │┃ - -┃└────────────────────────────────────────────────────────────────────────────────────────────────────┘┃ - -┃┌ Master output [output · Built-in Audio Analog Stereo] pickup: tracking───────────────────────────┐┃ - - - -┃│ -████████████████████████████████████████████████████████████████████████████████████████ -│┃ - - - - - -┃│ -████████████████████████████████████████████████ -88% -███████████████████████████████████ -│┃ - -┃└────────────────────────────────────────────────────────────────────────────────────────────────────┘┃ - -┃ -┃ - -┃ -┃ - -┃ -┃ - -┗APC MINI: connected (24:0)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - -╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ - -│ - ↑↓/jk -select - ←→ -volume - M -mute - Home/End -0/100% - T -theme - Tab -config - Q -quit - ⇧↑↓/⇧JK -move - A/E/D -se -│ - -╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +8 +6 +% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +A +P +C +M +I +N +I +: +c +o +n +n +e +c +t +e +d +( +2 +4 +: +0 +) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +↑ +↓ +/ +j +k +s +e +l +e +c +t +← +→ +v +o +l +u +m +e +M +m +u +t +e +H +o +m +e +/ +E +n +d +0 +/ +1 +0 +0 +% +T +t +h +e +m +e +T +a +b +c +o +n +f +i +g +Q +q +u +i +t +⇧ +↑ +↓ +/ +⇧ +J +K +m +o +v +e +A +/ +E +/ +D +s +e +p +a +r +a +t +o +r +⇧ +H +h +i +d +e +h +/ +? +h +e +l +p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/midi-identity.md b/docs/midi-identity.md index c9839c5..1cd890c 100644 --- a/docs/midi-identity.md +++ b/docs/midi-identity.md @@ -1,4 +1,10 @@ -# Linux MIDI identity spike +# Linux MIDI discovery and identity + +Run `fader_master devices` to inspect discovered ports. Config lists unclaimed +ports under Detected MIDI ports; open one to add it to the profile, then Save. +Configured MIDI devices have a details popup with connection status, backend +port, errors, and a default-controller toggle. Only a sole detected input is +automatically adopted when a managed profile is first created. `midir` 0.11.1 exposes Linux ports as ALSA sequencer `client:port` addresses and human-readable names. Neither value is a durable USB identity: client numbers @@ -36,5 +42,9 @@ would risk controlling the wrong applications. On 2026-10-14, the Arch Linux host exposed only `PortIdentity { backend_id: "14:0", name: "Midi Through:Midi Through Port-0 14:0", usb: None }`. This validates the virtual-client fallback but is not physical-controller -acceptance. The controller observations requested in `checklist.md` must be -recorded before M5.2 is marked complete. +acceptance. A later APC MINI observation on 2026-10-15 recorded USB +`09e8:0028`, serial `Ver00.10`, and backend port `36:0`; the serial stayed +stable when the USB socket changed. Two-identical-device ambiguity checks +remain open in [the backlog](../task.md) and +[hands-on checklist](../checklist.md). These are recorded observations, not +guarantees that every controller exposes a unique serial. diff --git a/docs/pulse-daemon-fixture.md b/docs/pulse-daemon-fixture.md index 59a07d1..e8a0214 100644 --- a/docs/pulse-daemon-fixture.md +++ b/docs/pulse-daemon-fixture.md @@ -5,6 +5,12 @@ session. Its normal phase creates a uniquely named, silent stereo stream with `paplay`, changes only that stream, and always terminates the child process. It never parses shell output in the production adapter. +This fixture tests audio behavior, not screenshots or the separator editor. +Layout, blank-name, save/reload, and rendering tests run in the ordinary +hardware-free suite. For interactive layout/MIDI checks, use the +[hands-on checklist](../checklist.md); for deterministic screenshots, see +[the documentation index](README.md). + ## Prerequisites - A reachable PulseAudio-compatible server. This can be PulseAudio itself or diff --git a/docs/related-projects.md b/docs/related-projects.md index 82b3804..e858130 100644 --- a/docs/related-projects.md +++ b/docs/related-projects.md @@ -17,3 +17,9 @@ layers used by fader_master: The detailed dependency choices, constraints, and licenses are recorded in the [architecture research table](../architecture.md#library-research-and-choices). + +Only the Pulse-compatible audio adapter is currently available at runtime; +PipeWire users connect through `pipewire-pulse`. The interface screenshots +are generated from fader_master's own Ratatui renderer. See +[configuration](configuration.md) for supported behavior and +[build instructions](build.md) for the pinned dependency/toolchain setup. diff --git a/task.md b/task.md index ab08c6e..aab557c 100644 --- a/task.md +++ b/task.md @@ -4,6 +4,12 @@ This is the build plan for `architecture.md`. Checked boxes record verified acce ## Planning delivered +Current user-facing baseline: live MIDI/Pulse server and TUI, all-in-one or +split processes, managed profile switching, guided fader editing, configurable +separators including unnamed spacers, themes, and pickup presentation. +Historical milestone notes below describe incremental delivery; unchecked +boxes still require their remaining acceptance evidence. + - [x] Inspect the workspace and define the project-steward role in `AGENTS.md`. - [x] Specify state ownership, adapter boundaries, matching/groups, MIDI identity/feedback, and TOML lifecycle in `architecture.md`. - [x] Research libraries using linked primary documentation and identify bounded technical spikes. @@ -202,8 +208,8 @@ Dependencies: M3; M4 for full end-to-end acceptance. APC MINI CC 48/49/50/56 and notes 64/65/66/98 to Music, Browser, Media, and the default output master. Input targeting an offline/read-only object is a nonfatal no-op, leaving other targets and the server available. Keep this item - open until pickup state is published to the TUI and profile-switch rearming is - implemented. + open for remaining physical multi-surface acceptance. Pickup snapshots and + profile-switch rearming are now implemented and covered by automated tests. - [ ] **M5.5 Physical smoke test:** one controller -> server -> application audio; then two controllers with overlapping MIDI message numbers. Acceptance: correct applications respond, bindings persist, and USB loss leaves server running. Record controller/firmware and environment. M5.1 verification on 2026-10-14: nine decoder/router/transport tests pass with @@ -236,7 +242,8 @@ Dependencies: M3, M2; may proceed after the fake-adapter slice. - [x] **M7.1 CLI:** serve/tui/validate/devices/status/profile switch arguments and override precedence. Tests: help/errors, invalid config has no side effects, explicit override wins for the session without silently modifying disk. Typed subcommands now validate profiles before probing audio or creating the runtime socket. `serve`, `tui`, `validate`, `devices`, and `status` are active; - `profile switch` parsing is reserved for the transactional M10 implementation. + Transactional profile switching is now implemented by M10.1, including the + Config-tab profile picker. A session audio override is applied only to runtime selection. - [x] **M7.2 IPC:** owned Unix socket, one-instance lock, version negotiation, length-bounded TOML frames, request IDs and revisioned state. Tests: wrong peer permissions, oversized/truncated/incompatible messages, second server, stale socket recovery and slow/disconnected client. The first local slice uses an owned mode-0600 socket, bounded request timeouts, diff --git a/tui/examples/doc_screenshots.rs b/tui/examples/doc_screenshots.rs index fa308ed..c9dc4de 100644 --- a/tui/examples/doc_screenshots.rs +++ b/tui/examples/doc_screenshots.rs @@ -48,14 +48,14 @@ fn main() -> io::Result<()> { fs::create_dir_all(&output)?; render( MixerOrientation::Horizontal, - 140, - 26, + 148, + 24, output.join("mixer-horizontal.svg"), )?; render( MixerOrientation::Vertical, - 104, - 38, + 148, + 27, output.join("mixer-vertical.svg"), ) } @@ -76,6 +76,7 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot { let targets = [ (MixerObjectKind::Application, "music", "Music"), (MixerObjectKind::Application, "browser", "Browser"), + (MixerObjectKind::Application, "voice", "Voice chat"), (MixerObjectKind::Group, "media", "Media group"), (MixerObjectKind::Output, "default", "Master output"), ]; @@ -94,13 +95,13 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot { MixerObjectKind::Output => "Built-in Audio Analog Stereo", } .to_owned(), - gain: Some([0.78, 0.46, 0.62, 0.88][index]), + gain: Some([0.72, 0.38, 0.55, 0.72, 0.86][index]), gain_mixed: kind == MixerObjectKind::Group, - muted: Some(index == 1), + muted: Some(index == 2), mute_mixed: kind == MixerObjectKind::Group, pending: false, pickup: Some(match index { - 0 | 3 => PickupStatus::Tracking, + 0 | 2 | 4 => PickupStatus::Tracking, 1 => PickupStatus::Waiting, _ => PickupStatus::Mixed, }), @@ -144,7 +145,7 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot { profile_id: "desktop".to_owned(), available_profiles: vec!["desktop".to_owned()], mixer_orientation, - status_display: tui::StatusDisplayMode::Detailed, + status_display: tui::StatusDisplayMode::Symbol, default_controller: Some("apc-mini".to_owned()), theme: ThemeName::CatppuccinMocha, applications: vec![ @@ -158,6 +159,11 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot { label: "Browser".to_owned(), selectors: Vec::new(), }, + ConfiguredApplication { + id: "voice".to_owned(), + label: "Voice chat".to_owned(), + selectors: Vec::new(), + }, ], groups: vec![ConfiguredGroup { id: "media".to_owned(), @@ -166,44 +172,81 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot { volume_mode: GroupVolumeMode::Absolute, }], faders, - mixer_layout: vec![ - MixerLayoutEntry::Separator { - id: "applications".to_owned(), - label: "Applications".to_owned(), - size: tui::SeparatorSize::Standard, - decoration: tui::SeparatorDecoration::Line, - }, - layout_fader( - "music", - horizontal_density(mixer_orientation, FaderDensity::Standard), - ), - layout_fader( - "browser", - horizontal_density(mixer_orientation, FaderDensity::Slim), - ), - MixerLayoutEntry::Separator { - id: "groups".to_owned(), - label: "Groups".to_owned(), - size: tui::SeparatorSize::Standard, - decoration: tui::SeparatorDecoration::Line, - }, - layout_fader("media", FaderDensity::Thick), - MixerLayoutEntry::Separator { - id: "outputs".to_owned(), - label: "Outputs".to_owned(), - size: tui::SeparatorSize::Standard, - decoration: tui::SeparatorDecoration::Line, - }, - layout_fader( - "default", - horizontal_density(mixer_orientation, FaderDensity::Standard), - ), - ], + mixer_layout: if mixer_orientation == MixerOrientation::Horizontal { + vec![ + layout_fader("music", FaderDensity::Thick), + layout_fader("browser", FaderDensity::Thick), + layout_fader("voice", FaderDensity::Thick), + separator( + "group-divider", + "", + tui::SeparatorSize::Slim, + tui::SeparatorDecoration::Double, + ), + layout_fader("media", FaderDensity::Thick), + separator( + "before-master", + "", + tui::SeparatorSize::Fill, + tui::SeparatorDecoration::Plain, + ), + layout_fader("default", FaderDensity::Thick), + ] + } else { + vec![ + MixerLayoutEntry::Separator { + id: "applications".to_owned(), + label: "Applications".to_owned(), + size: tui::SeparatorSize::Slim, + decoration: tui::SeparatorDecoration::Double, + }, + layout_fader( + "music", + horizontal_density(mixer_orientation, FaderDensity::Standard), + ), + layout_fader( + "browser", + horizontal_density(mixer_orientation, FaderDensity::Slim), + ), + layout_fader("voice", FaderDensity::BorderedSlim), + MixerLayoutEntry::Separator { + id: "groups".to_owned(), + label: "Groups".to_owned(), + size: tui::SeparatorSize::Slim, + decoration: tui::SeparatorDecoration::Line, + }, + layout_fader("media", FaderDensity::Standard), + MixerLayoutEntry::Separator { + id: "outputs".to_owned(), + label: "Outputs".to_owned(), + size: tui::SeparatorSize::Slim, + decoration: tui::SeparatorDecoration::Line, + }, + layout_fader( + "default", + horizontal_density(mixer_orientation, FaderDensity::Standard), + ), + ] + }, bindings: Vec::new(), }, } } +fn separator( + id: &str, + label: &str, + size: tui::SeparatorSize, + decoration: tui::SeparatorDecoration, +) -> MixerLayoutEntry { + MixerLayoutEntry::Separator { + id: id.to_owned(), + label: label.to_owned(), + size, + decoration, + } +} + const fn horizontal_density( orientation: MixerOrientation, vertical_density: FaderDensity, @@ -248,18 +291,13 @@ fn buffer_svg(buffer: &Buffer) -> String { } start = end; } - let mut start = 0; - while start < buffer.area.width { - let cell = &buffer[(start, y)]; - let mut end = start + 1; - let mut text = cell.symbol().to_owned(); - while end < buffer.area.width { - let next = &buffer[(end, y)]; - if next.fg != cell.fg || next.modifier != cell.modifier { - break; - } - text.push_str(next.symbol()); - end += 1; + for x in 0..buffer.area.width { + let cell = &buffer[(x, y)]; + let text = cell.symbol(); + let foreground = color(cell.fg, "#cdd6f4"); + if let Some(glyph) = cell_shape(text, x * CELL_WIDTH, y * CELL_HEIGHT, &foreground) { + svg.push_str(&glyph); + continue; } if !text.trim().is_empty() { let weight = if cell.modifier.contains(Modifier::BOLD) { @@ -269,20 +307,58 @@ fn buffer_svg(buffer: &Buffer) -> String { }; svg.push_str(&format!( "{}\n", - start * CELL_WIDTH, + x * CELL_WIDTH, y * CELL_HEIGHT + 1, - color(cell.fg, "#cdd6f4"), + foreground, weight, - escape_xml(&text) + escape_xml(text) )); } - start = end; } } svg.push_str("\n\n"); svg } +// Draw terminal strokes and blocks to their cell edges. Font metrics vary +// between SVG viewers and otherwise leave gaps in borders and filled meters. +fn cell_shape(symbol: &str, x: u16, y: u16, color: &str) -> Option { + let path = match symbol { + "─" => "M0 9 H9", + "│" => "M4.5 0 V18", + "┌" => "M4.5 18 V9 H9", + "┐" => "M0 9 H4.5 V18", + "└" => "M4.5 0 V9 H9", + "┘" => "M0 9 H4.5 V0", + "╭" => "M4.5 18 V13.5 Q4.5 9 9 9", + "╮" => "M0 9 Q4.5 9 4.5 13.5 V18", + "╰" => "M4.5 0 V4.5 Q4.5 9 9 9", + "╯" => "M0 9 Q4.5 9 4.5 4.5 V0", + "━" => "M0 8 H9 M0 9 H9", + "┃" => "M4 0 V18 M5 0 V18", + "┏" => "M4 18 V8 H9 M5 18 V9 H9", + "┓" => "M0 8 H5 V18 M0 9 H4 V18", + "┗" => "M4 0 V9 H9 M5 0 V8 H9", + "┛" => "M0 9 H5 V0 M0 8 H4 V0", + "═" => "M0 7 H9 M0 11 H9", + "║" => "M3 0 V18 M6 0 V18", + "╔" => "M3 18 V7 H9 M6 18 V11 H9", + "╗" => "M0 7 H6 V18 M0 11 H3 V18", + "╚" => "M3 0 V11 H9 M6 0 V7 H9", + "╝" => "M0 11 H6 V0 M0 7 H3 V0", + "█" | "░" => { + return Some(format!( + "\n", + if symbol == "█" { "1" } else { "0.18" } + )); + } + _ => return None, + }; + Some(format!( + "\n" + )) +} + fn color(color: Color, reset: &str) -> String { match color { Color::Reset => reset.to_owned(),