Skip to content

Remove binding of preferred input device#686

Open
grohith327 wants to merge 1 commit into
mainfrom
rohith/680-fallback-bind-on-failure
Open

Remove binding of preferred input device#686
grohith327 wants to merge 1 commit into
mainfrom
rohith/680-fallback-bind-on-failure

Conversation

@grohith327

Copy link
Copy Markdown
Collaborator

Description

The coordinator attempts to change the microphone input when manual mode is enabled. When that fails, the audio capture never starts. This change fixes that. We fully default to the microphone coordinator to pick the right input device now and remove the check that happens before it

Type of Change

  • 🐞 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 🧹 Chore
  • 📝 Documentation update

Related Issue or Discussion

#680

Testing

  • Tested on Apple Silicon Mac
  • Tested on macOS version:
  • Ran linter locally: swiftlint --strict --config .swiftlint.yml Sources
  • Ran formatter locally: swiftformat --config .swiftformat Sources

Test cases

Test case Manual mode Preferred input vs. macOS default Faster Recording Start Capture path Expected result Status
1 Off Same Off AVAudioEngine Uses macOS default and starts recording ✅ Passed
2 Off Different Off AVAudioEngine Ignores saved preference, uses macOS default ✅ Passed
3 On Same Off AVAudioEngine Detects preferred input is already default and starts ✅ Passed
4 On Different Off AVAudioEngine Makes preferred input the macOS default, then starts ✅ Passed
5 Off Same On Direct Core Audio Captures from macOS default ✅ Passed
6 Off Different On Direct Core Audio Ignores saved preference, captures from macOS default ✅ Passed
7 On Same On Direct Core Audio Captures directly from the preferred/default input ✅ Passed
8 On Different On Direct Core Audio Applies and captures from the preferred input ✅ Passed

Screenshots / Video

CleanShot 2026-07-21 at 20 01 39@2x
  • No UI/visual changes; screenshots/video are not applicable.

Notes

Add reviewer context, rollout notes, or known tradeoffs here.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4353b80c75

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

AppServices.shared.microphonePreferenceCoordinator.enforcePreferredInput(reason: "recording start")
}
let microphoneCoordinator = AppServices.shared.microphonePreferenceCoordinator
let enforcementResult = microphoneCoordinator.enforcePreferredInput(reason: "recording start")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve manual capture when default routing fails

When manual mode's setDefaultInputDevice call fails, enforcePreferredInput returns .failed while leaving the prior default unchanged (as the added coordinator test verifies), but this result is only logged. With direct capture disabled (the default), the compatibility AVAudioEngine path now follows that stale default because the per-engine binding was removed, so recording silently uses the wrong microphone instead of the user's selected manual device.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a bug where audio capture would fail to start in manual microphone mode by removing the AVAudioEngine direct device-binding layer and delegating entirely to MicrophonePreferenceCoordinator.enforcePreferredInput to set the macOS system default input before capture begins.

  • bindPreferredInputDeviceIfNeeded, setEngineInputDevice, tryBindToSystemDefaultInput, and unbindInputDevice are all removed from ASRService. The engine now follows the macOS system default, which the coordinator already sets correctly in manual mode. The enforcePreferredInput result is logged but no longer gates recording start, fixing the regression.
  • A new test (testMicrophoneCoordinatorPreservesDefaultWhenManualPreferenceCannotBeApplied) covers the coordinator failure path, and FakeAudioDeviceManager gains a setInputSucceeds flag to support the simulation.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to the input device binding path, all existing test cases pass per the PR matrix, and the new test directly covers the previously unhandled failure branch.

The deletion of the explicit device-binding layer is internally consistent: since the engine is never explicitly bound to a specific device, nothing needs to be unbound on teardown, and Bluetooth devices will return to A2DP naturally when the engine stops and is retired. The coordinator's unconditional call on every recording start is a no-op in system mode so there is no behavioral regression for that mode. The new test correctly validates the coordinator's state when setDefaultInputDevice fails.

No files require special attention.

Reviews (1): Last reviewed commit: "Fix for bind failure" | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown

FluidVoice PR build ready

Download FluidVoice-PR-686-4353b80c750a

The artifact contains the ad-hoc-signed app ZIP, Xcode archive, build manifest, and installation instructions. It expires 5 days after the build.

Install the app

  1. Extract the downloaded artifact, then extract FluidVoice-PR-686.app.zip.

  2. Move FluidVoice Remove binding of preferred input device #686.app into the /Applications folder.

  3. Open Terminal and remove the download quarantine marker:

    xattr -dr com.apple.quarantine "/Applications/FluidVoice #686.app"
    
  4. In Applications, Control-click FluidVoice Remove binding of preferred input device #686.app and choose Open.

  5. If macOS still blocks it, open System Settings → Privacy & Security, click Open Anyway, and confirm.

This build has its own app identity, so its permissions are separate from the release version of FluidVoice.

View workflow run

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