alsa: Add configurable delay after sample rate change#200
Closed
wtp128pro wants to merge 1 commit into
Closed
Conversation
Writes silence to the PCM device for a user-configurable duration whenever the sample rate changes between tracks (including on first open after a cold start). This gives hardware DACs time to settle before audio begins, preventing the first portion of a track from being lost during the hardware transition. The delay is exposed as a spin button in the ALSA plugin preferences (0-10000 ms, step 10, default 0 = disabled). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
I don't like this. It is AI-generated, right? From a quick scan:
Sorry, I don't have time to review in more detail. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
write_silence_locked()helper that writes zero-filled frames to the PCM device viasnd_pcm_writeifor a configurable durationstart_playback()immediately aftersnd_pcm_prepare()succeeds, so silence is written while the mutex is held and the pump thread is blocked — the only point where a direct write survives to hardwareopen_audio()and arms the silence duration if the setting is non-zeroMotivation
Some hardware DACs need a short settling period when the PCM sample rate changes. Without a delay, the first few milliseconds of audio after a rate transition are lost or corrupted. This is also observable on cold start when audacious first opens the audio device.
Test plan
🤖 Generated with Claude Code