The bars used a fixed cyan->purple default. Now they take contrast colors from
the album artwork, with a negative-fallback for dark covers (a near-black
Metallica album would vanish against the black background -> invert so the bars
pop).
- immersive.rs: spectrum_colors() extracts the most saturated sample as primary
+ a hue-distinct secondary (channel-rotated if none distinct); if the cover is
too dark/desaturated it uses the NEGATIVE of the average. ensure_visible_on_black()
inverts a too-dark color and lifts a dim one so both stops read on black.
- ImmersiveState gains spectrum-primary / spectrum-secondary (defaults cyan->purple
until art resolves); set in playback.rs from the same decoded artwork as
glow-color / bg-image.
- SpectrumPanel binds the bar gradient to those (base = primary, tip = secondary).
cc
The cubelet port instantiated ~80 Rectangles per column x2 mirror x14 bins
(~2240 retained scene-graph nodes) whose `visible` flipped every frame off an
animated `shown-cubes`. Audio updates at 30fps kept that animation from ever
settling, so ~2240 visible-bindings re-evaluated per frame and femtovg
re-rasterized hundreds of tiny rects - ~5fps and a large CPU spike. Tauri is
cheap because it is immediate-mode Canvas2D (fillRect), not a retained tree.
Fix: one solid gradient bar per column (2 nodes/pair, ~28 total) with an
animated height. Same geometry (28 mirrored columns, baseY 0.85H, maxBarHeight
0.7H, widths/offsets), same data binding (VisualizerState.bars, bounds-safe),
same cyan->purple default gradient (now a vertical fill instead of per-cube).
Dropped the discrete-cubelet texture for the perf win; it can return cheaply as
a static stripe overlay if wanted. Removed the unused cube-indices array.
cc
New SpectrumPanel.slint: faithful port of VisualizerPanel.svelte (the 16-bar
spectrum, not SpectralRibbon/Oscilloscope/LineBed).
- 16 source bars, bins {1,15} excluded -> 14 active -> 28 mirrored columns.
Geometry exact to source: bar-gap 4, total-bar-width W/28, baseY 0.85H,
maxBarHeight 0.7H, xLeft/xRight per spec.
- Discrete 6px+2px cubelets with per-cubelet gradient (gradientRatio
min(c/20,1), primary->secondary). GPU path (ADR-011); CPU flat fallback not
ported (Slint is GPU by default).
- Heights driven by VisualizerState.bars (bounds-safe clamp, 30fps len-16
VecModel) + a short animate settle - NO Timer. Bars already smoothed+clamped
in qbz-audio (no double-EMA). Now-playing card reuses the sibling pattern.
- Mounted on mode==3; modes 0/1/2 untouched.
Logged minors: MAX_CUBES=80 clips full-amplitude bars on very tall / 4K
windows (raise as a cheap follow-up); two-color gradient ships the Svelte
default cyan->purple (no album-derived secondary color wired yet); smoothing
is the Rust asymmetric EMA, not the Svelte symmetric 0.6 (deliberate, shared
pipeline).
cc