Skip to content

feat: added option to lock a device config to its output device - #43

Merged
ZortexSenpai merged 1 commit into
mainfrom
feat/lock-output-device
Dec 4, 2026
Merged

ZortexSenpai merged 1 commit into
mainfrom
feat/lock-output-device

Conversation

@ZortexSenpai

Copy link
Copy Markdown
Owner

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 of the active config not found
-  open the system default instead
-  forget the device, make "System default" the active config
+  if the config is locked
+    open nothing, pause, keep the config active
+    retry the device every second → reopen when it is back (stays paused)
+    play / pick a Song meanwhile → "not connected" toast, nothing plays
+  else
+    open the system default instead          (unchanged)
+    forget the device, "System default"      (unchanged)
 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_url example with a device id that does not exist (REVERB_LOCKED is new):

  • Before / unlocked:
    [WARN] saved output device coreaudio:no-such-device is gone; starting on the system default
    OutputDeviceLost { device: "coreaudio:no-such-device" }
    State { state: Playing }   output_device: Some("MacBook Pro Speakers")
    
    After / REVERB_LOCKED=1:
    [WARN] locked output device coreaudio:no-such-device is not connected; waiting for it
    LockedDeviceMissing { device: "coreaudio:no-such-device" }
    State { state: Paused }
    LockedDeviceMissing { device: "coreaudio:no-such-device" }   ← the Song asked to play
    
  • Locked + exclusive on a device that is present: plays as before.
  • cargo test --workspace and npm test (207) pass. New test: a_locked_config_locks_the_output_to_its_device (lockDevice round-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

lockDevice is a new field defaulting to false. 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

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>
@ZortexSenpai
ZortexSenpai merged commit 71fdbfc into main Dec 4, 2026
10 checks passed
@ZortexSenpai
ZortexSenpai deleted the feat/lock-output-device branch December 4, 2026 22:22
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.

1 participant