Repository navigation
feat(gui): add a visualizer screen with the TUI styles - #965
Conversation
A new cava plan reset the ring and the frame count that the GUI player bar reads, so the bar blinked when another reader changed the count.
A page that shows the screen asks for frames at its band count. The player bar's feed shares its capture, linger and stall rules with the screen, and the bar's own frames do not change.
Band counts, channel and level helpers, peaks, and the physics of each style, ported from the TUI.
Cava, Bar Graph, Head Unit, Analog VU, Winamp, Phosphor Scope, Outrun, Rack EQ and Cassette Deck on a canvas, with the TUI's colours and text.
Key 7 and a top-bar button open it. The style choice stays in the page; V cycles it as in the TUI.
The capture ring is not part of the plan, so set_bars no longer takes it out and puts it back. A spectrum frame now carries the capture's frame count.
The screen reads its frame and the audio count under one lock, both feeds use one clock and one silence rule, and the analyzer alone clamps the band count.
clock, mix, rgba, shownAt and Frame replace their copies; duplicate and test-only code goes. Frames decode once, and the painters measure text and stroke paths less often.
The screen asks with an optional band count, null when it hides, and VisualizerStyle gets a generated binding. The e2e stub narrows the ask instead of casting it.
…step Both frame paths mark new audio through one helper, and the docs name the screen next to the bar.
LED, strip and meter colours are built once, long paths glow with a double stroke instead of shadowBlur, and polyline builds no point tuples. The page reuses pageStorage, LONGEST_STEP and the list-sort controls, and its style list follows the generated binding.
The page watches once and sends a new band count on its own, so a resize or a style switch no longer drops the watch. One table names the styles in cycle order, LED and segment colours come from one helper, and the scanlines, needle shadow and rack labels cost less per frame.
fitBands returns zeros for an empty frame, so the painters read the bands directly and Scene.bars goes. The Next style tooltip reuses the translated hint, and a few constants and lookups move out of the loops.
The watched flag and the band count travel as one Option, and the two bridge visualizer tests share their socket setup and frame collection.
sceneAudio sizes the bands and flattens a silent wave once, so the painters read scene.audio directly. Settled silence reuses one cached zero array instead of allocating each frame.
Settled silence keeps its own array again, so fitBands needs no module state. scopeReadout and a screen test lose checks that can no longer fail.
barCount asks cava for twice each painter's band count, so the painters read the fitted bands without a second resample, and fitBands lets resample handle an empty frame.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Screen-frame contract and spectrum access src/gui/protocol.rs, src/core/driver/mod.rs, src/core/user_config.rs, src/infra/audio/analyzer.rs |
The protocol adds screen-frame messages with band and waveform data. The driver exposes spectrum data at a requested band count. The analyzer tracks written frames and preserves recent audio when the bar count changes. |
Screen capture and frame transport src/gui/bridge.rs, src/gui/visualizer.rs, src/runtime/gui.rs |
The bridge tracks screen watchers and requested bar counts. The visualizer feed manages screen capture and frame generation, including silence and capture-retention behavior. The runtime publishes screen frames when requested. |
Visualizer data model and drawing helpers gui/src/screenModel.ts, gui/src/screenDraw.ts, gui/src/visualizerModel.ts, gui/src/screenModel.test.ts |
The screen model adds style selection, audio processing, and animation calculations. Shared canvas helpers and tests support those calculations. Visualizer model utilities are exported for reuse. |
Visualizer style painters gui/src/screenPaint.ts, gui/src/screenRetro.ts, gui/src/screenPaint.test.ts |
The painter registry covers the visualizer styles. The painters draw spectrum bars, a VFD display, and six retro-style visualizations. Tests exercise the painters with sound and silence at multiple canvas sizes. |
GUI page, stream subscription, and integration tests gui/src/VisualizerScreen.tsx, gui/src/VisualizerScreen.css, gui/src/App.tsx, gui/src/Shell.tsx, gui/src/connection.ts, gui/src/TopBar.tsx, gui/src/Icon.tsx, gui/src/areas.ts, gui/src/nav.ts, gui/src/i18n.ts, gui/e2e/*, gui/src/visualizerScreen.test.tsx, gui/src/areas.test.ts, gui/src/nav.test.ts, src/core/i18n/gui.rs, src/core/i18n/gui/en.rs |
The GUI adds the visualizer page, screen-feed subscription, style controls, and navigation. Tests cover page behavior, keyboard style cycling, and screenshots for each style. |
Estimated code review effort: 4 (Complex) | ~60 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant VisualizerScreen
participant Connection
participant GUIBridge
participant VisualizerFeed
participant Driver
VisualizerScreen->>Connection: Subscribe and request bars
Connection->>GUIBridge: Send screen-frame request
GUIBridge->>VisualizerFeed: Track screen watcher and requested bars
VisualizerFeed->>Driver: Read spectrum at requested bars
VisualizerFeed-->>GUIBridge: Provide screen frame
GUIBridge-->>Connection: Send visualizer_screen message
Connection-->>VisualizerScreen: Deliver timestamped frame
Possibly related PRs
- LargeModGames/spotatui#963: Adds a detachable TUI visualizer pane and style persistence, which shares visualizer styles and bar-sizing behavior with this GUI screen.
- LargeModGames/spotatui#959: Changes Linux audio capture availability, which affects whether the screen can receive audio.
- LargeModGames/spotatui#939: Adds GUI navigation and visualizer translations related to the new visualizer page and its labels.
Merge Risk: 
Minimal · up to 8242d
-
The reviewed visualizer paths have no established merge-blocking issue. The page can fit shared frames, and zero-length tracks use the intended fallback.
Pre-merge checks: 
4
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
Simplify code
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
# Summary Version bump and changelog for v0.48.0. No application code changes. - `Cargo.toml`, `Cargo.lock`, `desktop/Cargo.toml` and `desktop/Cargo.lock` go to 0.48.0. The librespot fork stays at `=0.8.7`. - `CHANGELOG.md`: `## [Unreleased]` is now `## [v0.48.0] 2026-11-07`. I checked every PR merged since v0.47.0 against it and added entries for the GUI visualizer page (#965), the lyric seek in the terminal (#970), the completed Chinese translation (#939, #953, #956, #962), the Recently Played stubs (#982), cover art in iTerm2 (#979), the librespot 0.8.7 bump for #676 (#955) and the ten bug fixes in #954. # Testing - cargo test --no-default-features --features telemetry,tui: 1912 passed - cargo metadata on both manifests refreshed the two lock files. # Additional notes The desktop shell test `version_matches_root` runs in the desktop workflow, not locally. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * This release includes new features across the terminal, desktop app, and command-line interface. * **Localization** * Chinese translations are complete. * **Bug Fixes** * Fixed issues affecting listening history, iTerm2 cover art, native queue playback, and other reported areas. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
The GUI gets a Visualizer page with all nine TUI visualizer styles: Cava, Bar Graph, Head Unit, Analog VU, Winamp, Phosphor Scope, Outrun, Rack EQ and Cassette Deck. The player bar visualizer is unchanged.
7or the new top bar button opens the page. A dropdown, the Next style button orV(as in the TUI) picks the style. The choice stays in the page's local storage; the TUI'sbehavior.visualizer_styleis not touched.ClientMessage::VisualizerScreen { bars }(nullwhen it hides) and getsServerMessage::VisualizerScreenframes with cava's mirrored stereo bands and the 50 ms wave, on a second watch channel in the bridge. The player bar'sFeedserves both consumers with one capture lifecycle, so the linger, stall and retry rules are shared and the bar's own frames stay the same.AudioAnalyzer::set_barsnow rebuilds only the cava plan. The capture ring and its frame count survive a band-count change, so the bar no longer sees an empty ring when the screen resizes.SpectrumDatacarries that frame count.VisualizerStylegets a generated TS binding, and the page's style table is typed by it, so a style added in Rust fails the page's type check.Testing
I ran these on Windows.
uri_round_tripuses a Unix path and fails on Windows onmaintoo; the WebKitfocus.shot.ts:70test also fails onmain. The newvisualizer screen <Style>scenes and theVcycle scene pass in Chromium, Firefox and WebKit, and their PNGs are in thegui-shotsartifact.Additional notes
..EN; the Next style tooltip reuses the already translatedvisualizer_style_hint.💬 Questions or want to chat with other contributors? Join the spotatui Discord.
Summary by CodeRabbit