fix(macos): avoid Bluetooth headset mics in automatic selection - #113
Merged
Merged
Conversation
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.
Why
Opening a Bluetooth headset's microphone switches AirPods and similar headsets into a low-quality call profile for everything they play. With the microphone set to Automatic, HEX opened the macOS default input, which becomes the headset as soon as it connects. With Keep ready, music sounded bad the whole time HEX was running (#106). With Release when idle, every shortcut chord that briefly matched the dictation key opened the mic and made the audio blip (#88).
What Changes
Automatic selection keeps its existing order (compiled device preferences, then the macOS default) with one change: when that default is a Bluetooth input and the Mac has a built-in microphone, HEX opens the built-in microphone instead.
A headset chosen explicitly in Settings, and the CLI
--deviceoverride, are still opened as before. Each skip is logged with both device names.The transport comes from CoreAudio (
kAudioDevicePropertyTransportType, Bluetooth or Bluetooth LE versus built-in), resolved from cpal's device UID, because cpal does not report it on macOS.Scope
Fixes #106 and #88 for Automatic selection. It does not change an explicitly saved device or follow default-device changes while a warm stream is already open.
Verification
cargo fmt --check cargo clippy --all-targets --all-features -- -D warnings cargo test git diff --checkautomatic_input_prefers_built_in_over_a_bluetooth_defaultselection table.MacBook Pro Microphone: BuiltIn,BlackHole 2ch: Other, iPhone Continuity micOther. AirPods were not connected, so the Bluetooth branch has not been exercised against a real headset yet.