Skip to content

Fix audio device reopen#4806

Open
fire332 wants to merge 2 commits into
ankitects:mainfrom
fire332:fix-audio-device-reopen
Open

Fix audio device reopen#4806
fire332 wants to merge 2 commits into
ankitects:mainfrom
fire332:fix-audio-device-reopen

Conversation

@fire332
Copy link
Copy Markdown

@fire332 fire332 commented May 9, 2026

Linked issue (required)

Fixes #4805

Summary / motivation (required)

This eliminates the close & re-open audio device behavior which prevents some negative device-dependent behaviors from occurring. e.g. some bluetooth headphones cycle sleep states which causes a long delay between audio clips in a card; S/PDIF devices like AVRs have the beginning of the audio cut off as it transitions between audio formats.

Steps to reproduce (required, use N/A if not applicable)

  1. Switch to bluetooth headphones that sleep when the audio device is closed (e.g. Galaxy Buds2 Pro)
  2. Ensure Deck Options -> Audio -> Don't play audio automatically is OFF
  3. Study a card with multiple audio clips

How to test (required)

Checklist (minimum)

  • I ran ./ninja check or an equivalent relevant check locally.
  • I added or updated tests when the change is non-trivial or behavior changed.

Details

None.

Before / after behavior (optional)

With the fix applied using appropriate bluetooth headphones, there's no longer a few-second long delay between audio clips and no fade-in effect on subsequent audio clips.

Risk / compatibility / migration (optional)

Going through the git blame:

  • keep-open=no force mpv --keep-open=no #232: allows the idle_active property to change on playback finish. This is addressed by adding another property observer for eof_reached that calls idle_active.
  • gapless-audio=no Audio pause fix #1221: fixes audio cutting off early. It's been 5 years since that PR and I can't re-produce it.

Platform-dependent delay is removed.

Due to the nature of this change, the delay between audio clips is almost completely eliminated. The implication is that cards/decks that rely on the natural delay between clips may sound jarring. Decks should not be relying on this delay in the first place, which can vary with OS, drivers, devices, etc. An option to add a delay between auto-played clips can be added for deck authors if this is an issue.

UI evidence (required for visual changes; otherwise N/A)

N/A

Scope

  • This PR is focused on one change (no unrelated edits).

fire332 added 2 commits May 9, 2026 15:37
This prevents certain devices like some bluetooth headphones from cycling sleep states which causes a long delay between audio clips in a card.
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 Anki | 🛠️ Build #32619860 | 📁 Comparing d16f95d against latest (428406d)

  🔍 Preview build  

2 files changed
± genindex.html
± autoapi/aqt/sound/index.html

@fire332 fire332 marked this pull request as draft May 10, 2026 02:46
@fire332 fire332 marked this pull request as ready for review May 10, 2026 03:23
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.

Audio device re-opened between queued clips

1 participant