fix: fall back to default microphone after disconnect - #1874
Conversation
|
Some additional context from testing this on macOS: Before this change, Handy could keep an unavailable microphone selected after it was unplugged. CoreAudio stopped delivering samples, but the stream still looked open to Handy. A recording would produce no transcription, and canceling it and changing the microphone could leave the entire app frozen until I force quit it. With this change, Handy detects the failed stream, closes it, clears the unavailable selection, and falls back to the system default microphone. The microphone dropdown also updates to This makes a common laptop workflow seamless. I can move away from my desk microphone and keep dictating through the laptop microphone instead of discovering the problem through a silent recording and restarting Handy. |
|
Okay, thank you for the report on this and also the PR. I will try to take a look soon. Probably I'll get to it either tomorrow or the next day and merge it if I can replicate. I think I do have an external mic I can plug into my Mac and try to replicate and also see if the fix works as expected |
Before Submitting This PR
Human Written Description
Handy completely freezes on macOS when the selected microphone is unplugged. I switch between a desk microphone and my laptop microphone a lot at work, so I need Handy to fall back to an available source and let me keep working.
Related Issues/Discussions
Fixes #1743
PR #1838 recovers when the capture worker exits. On macOS, CoreAudio can report that the device is unavailable while leaving the worker and sample channel alive, so that recovery path does not run.
Community Feedback
Issue #1743 tracks the same failure and includes reports from macOS users.
If this is a feature or change that was previously closed/rejected: Not applicable. This is a bug fix for open issue #1743.
Testing
cargo test(179 passed)cargo clippy --lib --tests(passed with existing warnings)bun run check:translationsbun run lintbun run format:checkbun run buildbun run test:playwright(2 passed)bun.nixand confirmed it matches the committed fileManual test on macOS with a CalDigit TS4 Audio Rear input:
Handy now closes the stalled stream, selects the system default microphone, updates the dropdown to
Default, and records from the MacBook microphone. The app stayed responsive throughout.Nix flake evaluation was not run locally because Nix is not installed. The PR CI runner will cover it.
Screenshots/Videos (if applicable)
The microphone dropdown was observed changing from
CalDigit TS4 Audio - ReartoDefaultafter disconnect. No manual refresh was needed.AI Assistance
If AI was used: