Skip to content

Fix wrong audio sync delta after server-driven delay change - #245

Merged
maximmaxim345 merged 3 commits into
mainfrom
fix/static-delay
May 5, 2026
Merged

Fix wrong audio sync delta after server-driven delay change#245
maximmaxim345 merged 3 commits into
mainfrom
fix/static-delay

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

Server-initiated set_static_delay computed the audio sync delta from settings.static_delay_ms, which can lag the client's real delay when --static-delay-ms overrides settings or after a visualizer toggle. The audio worker then got a wrong correction.

Copilot AI review requested due to automatic review settings May 5, 2026 13:12
@maximmaxim345 maximmaxim345 added the bugfix Fixes a bug label May 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes incorrect audio sync correction when the server issues SET_STATIC_DELAY by tracking the currently applied static delay locally (instead of relying on settings.static_delay_ms, which can lag due to CLI overrides or client recreation).

Changes:

  • Add an optional on_delay_changed callback to the TUI keyboard command handler so the app can mirror local delay changes.
  • Track the applied delay in TUI (_applied_delay_ms) and daemon (_static_delay_ms) and compute server-driven delay deltas against that mirror.
  • Ensure newly created/recreated SendspinClient instances receive the mirrored applied delay value.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
sendspin/tui/keyboard.py Adds an optional delay-change callback and wires it through keyboard_loop/CommandHandler.adjust_delay.
sendspin/tui/app.py Introduces _applied_delay_ms, uses it when creating clients, and fixes server-driven delay delta computation.
sendspin/daemon/daemon.py Mirrors applied delay in _static_delay_ms, uses it for client creation, and fixes server-driven delay delta computation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sendspin/tui/keyboard.py
Comment thread sendspin/tui/app.py
Comment thread sendspin/tui/app.py
Comment thread sendspin/tui/app.py Outdated
Comment thread sendspin/daemon/daemon.py Outdated
Comment thread sendspin/daemon/daemon.py
@maximmaxim345
maximmaxim345 merged commit b714105 into main May 5, 2026
1 check passed
@maximmaxim345
maximmaxim345 deleted the fix/static-delay branch May 5, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants