Repository navigation
feat: added option to lock a device config to its output device - #43
Merged
Merged
Conversation
A device config can now be locked to its device. When the device is
unplugged or switched off, playback no longer moves to the system default
and the config is no longer dropped: Reverb pauses, keeps the config
active, and opens the device again as soon as it is back. Off by default;
one switch in the device config dialog ("Lock to this device").
- reverb-core: OutputSettings.locked. With the device missing, the engine
opens nothing (not the system default, not its card or hog mode),
pauses, and the recovery loop reopens the device once it is plugged in
again. LockedDeviceMissing / LockedDeviceReturned events; asking to play
meanwhile reports the device missing again instead of playing silently.
A locked device that will not open exclusively is shared rather than
left for the system default.
- Engine: no decoding into a ring with no stream, so a song started while
waiting keeps its opening; no 250 ms flush wait on a closed output.
- App: lockDevice on device configs (defaults to off for existing ones),
toasts for missing/reconnected, "Locked" in the config summary. The
switch needs a device: disabled for the system default, absent for
HQPlayer configs.
- Strings in all four languages; GLOSSARY.md updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
A Device config can be locked to its device. When the device is gone, playback pauses and waits for it instead of moving to the system default. The config stays active.
Device config dialog Output device Match source rate Exclusive access + Lock to this device (disabled for System default; absent for HQPlayer)Also: a locked config that can't get exclusive access shares the same device instead of falling back to the system default. While no output is open, the engine no longer decodes into the ring (a Song started while waiting would have lost its first ~0.7 s) and no longer waits 250 ms on a flush.
Evidence
play_urlexample with a device id that does not exist (REVERB_LOCKEDis new):REVERB_LOCKED=1:cargo test --workspaceandnpm test(207) pass. New test:a_locked_config_locks_the_output_to_its_device(lockDeviceround-trips, older configs default to unlocked,output()carries it).Not yet tested: unplugging and replugging a real DAC mid-playback (stream-error → wait → reconnect path), or the new switch in the running app.
Merge Danger
Door: two-way
lockDeviceis a new field defaulting tofalse. Older versions ignore it, so rolling back is safe.Blast Radius: audio-engine
Unlocked configs take the same paths as before. The engine changes that apply to every config are skipping the decode and the flush wait while no output is open. Today that only happens after a failed reopen, which the recovery loop retries anyway.
🤖 Generated with Claude Code