Skip to content

Fix aggregate device volume slider permanently broken after install#849

Open
pranahonk wants to merge 1 commit intokyleneideck:masterfrom
pranahonk:fix/aggregate-device-volume-848
Open

Fix aggregate device volume slider permanently broken after install#849
pranahonk wants to merge 1 commit intokyleneideck:masterfrom
pranahonk:fix/aggregate-device-volume-848

Conversation

@pranahonk
Copy link
Copy Markdown

Summary

Fixes #848 — Installing Background Music with an Aggregate Device as output permanently disables the aggregate device's volume slider in System Settings, even after uninstalling.

Root cause: BGMDeviceControlsList::MatchControlsListOf() uses deprecated AudioHardwareService* APIs to detect volume support, which return incorrect results for aggregate devices on newer macOS. This causes BGMDevice's volume control to be disabled, triggering PropagateControlListChange (a null-device toggle) that corrupts macOS's internal state for the aggregate device. Additionally, CopyVolumeFrom() uses these same deprecated APIs to write to the aggregate device's virtual master volume, which can permanently corrupt its volume control state.

Fix:

  • Add BGMAudioDevice::IsAggregate() to detect aggregate devices via kAudioDeviceTransportTypeAggregate
  • In MatchControlsListOf(): always report aggregate devices as having volume/mute controls (macOS provides virtual controls for them regardless)
  • In CopyVolumeFrom()/CopyMuteFrom(): skip volume/mute sync for aggregate devices to avoid corrupting their state via deprecated APIs
  • Fix pre-existing implicit int-to-float conversion warnings that prevent building on newer Xcode

Test plan

  • Build with latest Xcode (verified: all 3 targets build cleanly)
  • Create an Aggregate Device in Audio MIDI Setup
  • Set it as output device
  • Launch Background Music — volume slider should remain functional
  • Quit Background Music — volume slider should still work
  • Verify non-aggregate devices still have working volume sync

…yleneideck#848)

Skip volume/mute sync for aggregate devices to prevent deprecated
AudioHardwareService APIs from corrupting their volume control state.
Always report aggregate devices as having volume/mute controls so
BGMDevice controls stay enabled and PropagateControlListChange (null
device toggle) is not triggered.

Also fix implicit int-to-float conversion warnings for newer Xcode.
GloryWord added a commit to GloryWord/BackgroundMusic that referenced this pull request Apr 12, 2026
Recent post-v0.4.3 Tahoe reports pointed to two failure modes that made
Background Music feel unsafe to use: aggregate output devices could lose
usable volume controls, and quitting or uninstalling could leave the
system stuck at the wrong volume. This change pulls the minimal proven
fixes onto a single branch so Tahoe users can build from source without
reopening the broader helper/ducking design.

The aggregate-device lane now treats aggregate outputs as special cases
for control detection and skips deprecated volume/mute sync paths that
can corrupt System Settings state. The termination lane deactivates
control-sync and playthrough before restoring the default device, and the
uninstall path removes stale BGM device preference entries that can keep
incorrect volume state alive across restarts.

Constraint: Must stay close to upstream master to preserve CoreAudio behavior and ease future rebases
Constraint: Cannot fully verify privileged install/runtime helper behavior in this environment because sudo is unavailable
Rejected: Large Tahoe-specific refactor of the helper/ducking pipeline | too broad without a reproducible runtime failure locally
Rejected: Leaving the open Tahoe stability fixes unmerged locally | keeps known aggregate/shutdown regressions in the user build
Confidence: medium
Scope-risk: moderate
Reversibility: clean
Directive: Treat this as a Tahoe stability lane, not a complete fix for FaceTime/browser ducking; validate runtime capture separately on the target machine
Tested: xcodebuild build (Background Music Device, Background Music, BGMXPCHelper)
Tested: xcodebuild test -only-testing:BGMDriverTests
Tested: xcodebuild test -only-testing:BGMAppUnitTests
Not-tested: Privileged install of BGMXPCHelper/driver via launchd
Not-tested: Real FaceTime + browser YouTube runtime on macOS Tahoe 26.3.1
Related: upstream PR kyleneideck#849
Related: upstream PR kyleneideck#850
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.

Aggregate Device volume slider permanently broken after installing Background Music

1 participant