Repository navigation
fix(launcher): cache system volume so OSD and settings agree - #252
Merged
Merged
Conversation
The volume shortcut re-read the mixer on every press while Settings -> Speaker rendered whatever its own asynchronous read returned, so the two could show different values for the same mixer state. Read the mixer once at launcher startup on a worker thread. The reader waits for two consecutive equal readings before publishing, because WirePlumber applies the card's stored volume while it comes up, and falls back to the last valid reading if the value never settles. Shortcuts now step from the cached value instead of issuing another read, and every volume write updates the cache. Settings -> Speaker seeds its first frame from the same cache and pushes mixer results (read, preview and commit) back into it, so leaving the page cannot expose a stale value. The persisted config key remains only a fallback for a page opened before the startup read finished. Launcher teardown joins the startup reader, and the test build now links pthread for the worker thread.
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.
The volume shortcut re-read the mixer on every press while Settings -> Speaker rendered whatever its own asynchronous read returned, so the two could show different values for the same mixer state.
Read the mixer once at launcher startup on a worker thread. The reader waits for two consecutive equal readings before publishing, because WirePlumber applies the card's stored volume while it comes up, and falls back to the last valid reading if the value never settles. Shortcuts now step from the cached value instead of issuing another read, and every volume write updates the cache.
Settings -> Speaker seeds its first frame from the same cache and pushes mixer results (read, preview and commit) back into it, so leaving the page cannot expose a stale value. The persisted config key remains only a fallback for a page opened before the startup read finished.
Launcher teardown joins the startup reader, and the test build now links pthread for the worker thread.