fix(ui): decay visualizer to rest when paused - #327
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughPaused visualizer content now receives silence and decays toward rest. The model keeps fast ticks while decay is pending. The visualizer suspends paused drivers after settlement. Tests cover bars, peaks, caps, and stereo meters. ChangesPaused visualizer decay
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🟡 Moderate · up to The pause behavior change includes targeted tests, but the required Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Player
participant Model
participant Visualizer
participant Driver
Player->>Model: Playback becomes paused
Model->>Visualizer: Analyze silence
Visualizer->>Driver: Tick paused visualizer
Driver-->>Visualizer: Report decay pending or settled
Visualizer-->>Model: Continue or suspend ticks
Model-->>Player: Use fast cadence until settled
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
Summary
When playback is paused, the visualizer previously froze at its current state — spectrum bars, peak caps, and meters stayed stuck mid-frame. This makes the audio-driven visuals gently decay to empty instead of freezing, then settle to the idle cadence.
What changed
ui/visualizer.go—Tick()no longer hard-suspends on pause. It keeps ticking the active driver so the existing non-playing decay runs (silent band analysis + eased smoothing, target-zero physics for classic peak/stereo), and only suspends once the content has fully settled (all bands below an epsilon and no driver physics still animating). AddsPausedDecayPending()for the model.ui/model/tick.go— the analyzer feeds silence while paused (the audio tap otherwise replays the frozen last frame, so bands never fell).isFullyIdle()stays false while content is settling, andtickInterval()runs at the fast cadence during the brief decay so the fall is smooth (~20 FPS), then drops back toTickIdlewhen settled.Notes
The paused decay is temporary (a couple of seconds at ≤20 FPS, no FFT happens during pause since the silence gate short-circuits it), so it has no meaningful CPU/RAM impact — long-paused playback still returns to the 1.5s idle cadence.
Summary by CodeRabbit
Bug Fixes
Tests