Skip to content

fix(av-sync): make the A/V offset slider actually settable + un-clobberable#1046

Open
ahonnecke wants to merge 1 commit into
got-feedBack:mainfrom
ahonnecke:av-slider-fix
Open

fix(av-sync): make the A/V offset slider actually settable + un-clobberable#1046
ahonnecke wants to merge 1 commit into
got-feedBack:mainfrom
ahonnecke:av-slider-fix

Conversation

@ahonnecke

@ahonnecke ahonnecke commented Jul 25, 2026

Copy link
Copy Markdown

Problem

The A/V offset was practically unusable:

  • ±1000 slider range — the useful zone is a few unclickable pixels, so you can't dial in a precise value.
  • No exact entry — only a read-only label.
  • Auto-calibrate silently overwrote any hand-set value on song-end, so it read as "always wrong": you'd set it, then note_detect's auto-calibrate clobbered it.

Changes (core-only, no plugin change)

  • Narrow both A/V sliders ±1000 → ±300 (settings page + player popover) for real resolution.
  • Player popover: replace the read-only label with an exact-entry number box (arrow keys step ±1 ms) + a directional hint (higher = notes reach the strike line sooner / visuals faster).
  • setAvOffsetMs(ms, skipPersist, source): a user control passes 'manual' and sets a sticky override; the load path passes 'load'; any other caller (the plugin's untagged window.setAvOffsetMs auto-calibrate) is ignored while the override holds. Persist av_offset_manual (client + settings router + resettable keys) so a hand-set value survives reload and isn't re-clobbered.

The auto-calibrate block happens host-side via the source arg, so no note_detect change is required.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added manual A/V offset controls with a dedicated override setting.
    • Enter an exact offset value directly in the player controls.
    • Updated offset sliders to support adjustments from -300 to 300 ms.
    • Manual adjustments and nudges are preserved when automatic calibration runs.
  • Bug Fixes

    • Improved synchronization between sliders and numeric offset displays.
    • Added support for resetting the manual A/V offset override to default behavior.

…erable

The A/V offset was practically unusable: ±1000 slider range (useful zone a few
unclickable pixels), no exact entry, and note_detect's auto-calibrate silently
overwrote any hand-set value on song-end — so it read as "always wrong".

- Narrow both A/V sliders ±1000 → ±300 (settings + player popover) for real
  resolution.
- Player popover: replace the read-only label with an exact-entry number box
  (arrows step ±1 ms), plus a directional hint (higher = notes reach the strike
  line sooner / visuals faster).
- setAvOffsetMs(ms, skipPersist, source): a user control passes 'manual' and
  sets a sticky override; the load path passes 'load'; any other caller (the
  plugin's window.setAvOffsetMs auto-calibrate) is IGNORED while the override
  holds. Persist av_offset_manual (client + settings router + resettable keys)
  so a hand-set value survives reload and isn't re-clobbered.

Core-only — no plugin change needed; the block happens host-side.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eaade9f6-0f34-4df2-b3a8-80709d49a57e

📥 Commits

Reviewing files that changed from the base of the PR and between eef58c8 and c845b84.

📒 Files selected for processing (3)
  • lib/routers/settings.py
  • static/js/settings.js
  • static/v3/index.html

📝 Walkthrough

Walkthrough

Changes

The A/V offset settings API now validates, persists, and resets av_offset_manual. Frontend state tracks manual overrides, prevents automatic replacement, persists the flag, and synchronizes slider and exact numeric controls.

A/V offset override flow

Layer / File(s) Summary
Persisted override setting contract
lib/routers/settings.py
av_offset_manual is validated as a boolean, persisted when provided, and included among resettable settings.
Override-aware offset state
static/js/settings.js
Loading, offset updates, persistence, and keyboard nudges now track manual override state and restrict non-manual updates accordingly.
Manual offset controls
static/v3/index.html, static/js/settings.js
A/V offset sliders use a -300..300 range, manual sources, and a new exact numeric input synchronized with the offset state.

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

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant settings.js
  participant SettingsAPI
  Browser->>SettingsAPI: GET persisted A/V offset settings
  SettingsAPI-->>settings.js: av_offset_ms and av_offset_manual
  settings.js->>settings.js: apply loaded offset and override state
  Browser->>settings.js: enter or nudge manual offset
  settings.js->>SettingsAPI: POST updated offset and manual flag
  SettingsAPI-->>settings.js: persist settings response
Loading

Possibly related PRs

Suggested reviewers: byrongamatos, chrisbewithyou

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the core change, but it misses the template's What, feedpak surface, and checklist sections. Add the required What section, the feedpak surface checkbox block, and the checklist items for changelog, tests, and DCO.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately highlights the main A/V offset usability and persistence fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

1 participant