Skip to content

Add opt-in output lock for disconnected audio devices - #481

Draft
applepiepp wants to merge 1 commit into
ronitsingh10:mainfrom
applepiepp:feature/optional-output-device-lock
Draft

applepiepp wants to merge 1 commit into
ronitsingh10:mainfrom
applepiepp:feature/optional-output-device-lock

Conversation

@applepiepp

Copy link
Copy Markdown

When an HDMI monitor is powered off during playback, audio can fall back to another available speaker. This proposes an opt-in output-device lock: managed single-output apps stay silent while the chosen output is absent and return to it, with their volume and mute state preserved, after it reconnects. The setting is off by default.

Related: #375. This adds an optional no-fallback policy; it does not claim to resolve every reconnect scenario described there.

Implementation

  • Persist an optional locked output UID and expose the setting in Audio settings.
  • Retain a device-independent muted source tap while the output is missing or its rendering route is rebuilding. Keep policy silence separate from the user's mute setting.
  • Rebuild the route on reconnect, including when a stable UID gets a new Core Audio device identity. Refresh helper-process membership without dropping the existing guard first.
  • Preserve protection on activation failure and show waiting/error state.
  • Add regression tests and a separate headless unit-test scheme that does not initialize the menu bar, monitoring, or audio capture. The existing scheme and release identity remain unchanged.

Validation

  • Clean build-for-testing passed on macOS 27.0.1 / Apple Silicon.
  • 33 tests passed across AudioEngineOutputLockTests, ProcessTapOutputGuardTests, OutputLockSettingsTests, AudioEngineToggleMuteTests, and AudioEngineTapInitialStateTests.
  • In a locally isolated v1.9.0 trial using this implementation, the user confirmed: power off an HDMI LG monitor during playback -> other outputs remain quiet -> power the monitor back on -> playback returns to LG at the expected software volume. Hardware: Mac mini M4 Pro and LG 32GS95U.
  • This submission is rebased on upstream main 2285279. The cleaned contribution has been built and unit-tested; it has not replaced the hardware-tested local trial.

Review and testing still needed

This is an AI-assisted proposed implementation, submitted as a draft for maintainer review. The behavior silences managed playback; it does not pause the media timeline or guarantee system-wide silence. Ignored apps, explicit multi-output routes, unrelated explicit outputs, and system sounds are outside that guarantee. Newly discovered helper processes can emit initial samples before protection is installed.

Sleep/wake, five simultaneously playing apps, other output transports, and broader multi-output/system-sound interactions have not been hardware-tested. These remaining checks are why this is a draft rather than a claim of release readiness. The temporary trial's bundle ID, private settings, updater changes, and local paths are not included.

I would prefer this to become a supported upstream option rather than maintaining a separate distribution. Please let me know whether the policy/API fits the project or should be narrowed before proceeding.

temporaryna added a commit to temporaryna/FineTune that referenced this pull request Nov 16, 2026
…isconnect

Port of upstream PR ronitsingh10#481. When the lock is enabled in Audio settings,
follows-default apps are guarded to the selected output: if it
disconnects they stay silent (volume and mute preserved) instead of
failing over raw at full volume, and the guard releases only when the
same UID rebuilds on reconnect. While the lock is on, every
audio-capable process is pre-tapped so nothing can leak raw past its
guard (fork addition matching the lock's promise).

Two lock tests adapted to fork semantics (unconfigured silent apps have
no tap until the lock turns on) and the suite is serialized: fixtures
touch app-global TCC and NSApplication state. The settle helper now
sleeps briefly - fixed yield counts raced under parallel suite load.
HUD popupHiddenShowUpdatesPanel is environment-dependent upstream
(reads the real frontmost app) and fails when a fullscreen window has
focus - pre-existing, unrelated to this change.
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