Skip to content

fix(ui): decay visualizer to rest when paused - #327

Merged
bjarneo merged 1 commit into
bjarneo:mainfrom
tharinfernando:visualizer-decay-on-pause
Aug 20, 2026
Merged

fix(ui): decay visualizer to rest when paused#327
bjarneo merged 1 commit into
bjarneo:mainfrom
tharinfernando:visualizer-decay-on-pause

Conversation

@tharinfernando

@tharinfernando tharinfernando commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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.goTick() 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). Adds PausedDecayPending() 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, and tickInterval() runs at the fast cadence during the brief decay so the fall is smooth (~20 FPS), then drops back to TickIdle when settled.
  • Tests — new paused-decay coverage for bars, stereo, and classic peak (the old "paused freezes" test now asserts decay-to-rest), plus model tick-cadence tests for the settling and settled states. Confirmed the existing scope catch-up behavior is unchanged.

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

    • Paused visualizer animations now smoothly decay spectrum bars, peaks, and stereo meters toward rest instead of freezing.
    • Visualizer updates continue at a responsive cadence while paused content settles, then suspend once fully idle.
    • Improved handling of paused playback when no new audio samples are available.
  • Tests

    • Added coverage confirming paused visualizers decay monotonically and stop updating after settling.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1325d261-e195-46f8-bbff-7f15f4e7b257

📥 Commits

Reviewing files that changed from the base of the PR and between 0c9c30d and 5803765.

📒 Files selected for processing (6)
  • ui/model/tick.go
  • ui/model/tick_test.go
  • ui/vis_classic_peak_test.go
  • ui/vis_stereo_test.go
  • ui/visualizer.go
  • ui/visualizer_driver_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Paused 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.

Changes

Paused visualizer decay

Layer / File(s) Summary
Visualizer settlement lifecycle
ui/visualizer.go
Paused ticks continue while spectrum bands or driver animation remain unsettled. PausedDecayPending reports whether more paused updates are required.
Model pause scheduling
ui/model/tick.go, ui/model/tick_test.go
Paused playback feeds silence to the visualizer. The model uses fast ticks during decay and switches to idle after settlement.
Paused decay validation
ui/visualizer_driver_test.go, ui/vis_classic_peak_test.go, ui/vis_stereo_test.go
Tests verify monotonic decay, threshold-based settlement, and suspension for bars, classic peaks, and stereo meters.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🟡 Moderate · up to 58037

The pause behavior change includes targeted tests, but the required make check result is not provided. Merge should wait for that validation or explicit owner acceptance; no specific code defect is currently evidenced.

Suggested reviewers: bjarneo

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: making the visualizer decay to rest when playback is paused.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bjarneo
bjarneo merged commit 5ca8722 into bjarneo:main Aug 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants