Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

fix notify when microphone is selected

altic-dev5f6a1477fa14
diff --git a/Sources/Fluid/Services/ASRService.swift b/Sources/Fluid/Services/ASRService.swift
index 1085205a..1cf0e927 100644
--- a/Sources/Fluid/Services/ASRService.swift
+++ b/Sources/Fluid/Services/ASRService.swift
@@ -996,6 +996,10 @@ final class ASRService: ObservableObject {
)
self.audioStartAttemptInputUID = device.uid
self.audioStartAttemptInputName = device.name
+ AppServices.shared.microphonePreferenceCoordinator.reportResolvedSelection(
+ uid: device.uid,
+ name: device.name
+ )
let snapshot = try await self.directAudioLifecycleController.start(
deviceID: device.id,
deviceName: device.name,
@@ -2528,6 +2532,10 @@ final class ASRService: ObservableObject {
@discardableResult
private func setEngineInputDevice(deviceID: AudioObjectID, deviceUID: String, deviceName: String) -> Bool {
DebugLogger.shared.debug("setEngineInputDevice() - Binding input to device ID: \(deviceID)", source: "ASRService")
+ AppServices.shared.microphonePreferenceCoordinator.reportResolvedSelection(
+ uid: deviceUID,
+ name: deviceName
+ )
let inputNode = self.engine.inputNode
diff --git a/Sources/Fluid/Services/MicrophonePreferenceCoordinator.swift b/Sources/Fluid/Services/MicrophonePreferenceCoordinator.swift
index a8865a62..082835d2 100644
--- a/Sources/Fluid/Services/MicrophonePreferenceCoordinator.swift
+++ b/Sources/Fluid/Services/MicrophonePreferenceCoordinator.swift
@@ -45,8 +45,6 @@ final class MicrophonePreferenceCoordinator: ObservableObject {
private var startupNoticeTask: Task<Void, Never>?
private var startupNoticeEligibilityEnabled = false
private var didPresentStartupNotice = false
- private var startupNoticePresentedUID: String?
- private var startupNoticePresentedName: String?
init(
settings: SettingsStore? = nil,
@@ -180,11 +178,7 @@ final class MicrophonePreferenceCoordinator: ObservableObject {
availableInputs: availableInputs,
defaultInputUID: defaultInputUID
)
- self.lastResolvedInputUID = selectedInput?.uid
- self.lastResolvedInputName = selectedInput?.name
- if self.startupNoticeEligibilityEnabled {
- self.scheduleStartupNoticeAfterSelectionSettles()
- }
+ self.reportResolvedSelection(uid: selectedInput?.uid, name: selectedInput?.name)
if let confirmedActiveInputUID,
availableInputs.contains(where: { device in
device.uid == confirmedActiveInputUID && self.isInputDeviceAvailable(device)
@@ -195,8 +189,39 @@ final class MicrophonePreferenceCoordinator: ObservableObject {
return selectedInput
}
+ func reportResolvedSelection(uid: String?, name: String?) {
+ let previousUID = self.lastResolvedInputUID
+ let previousName = self.lastResolvedInputName
+ self.lastResolvedInputUID = uid
+ self.lastResolvedInputName = name
+
+ guard previousUID != nil, uid != previousUID else {
+ if self.startupNoticeEligibilityEnabled {
+ self.scheduleStartupNoticeAfterSelectionSettles()
+ }
+ return
+ }
+
+ if self.startupNoticeEligibilityEnabled, self.didPresentStartupNotice == false {
+ self.startupNoticeTask?.cancel()
+ self.startupNoticeTask = nil
+ self.didPresentStartupNotice = true
+ }
+
+ let notice = MicrophoneChangeNotice(
+ previousName: previousName,
+ currentName: name,
+ presentation: .selectionChange
+ )
+ DebugLogger.shared.info(
+ "Selected microphone changed from '\(notice.previousName ?? "none")' " +
+ "to '\(notice.currentName ?? "none")' before capture confirmation",
+ source: "MicrophonePreferenceCoordinator"
+ )
+ MicrophoneChangeOverlayController.shared.show(notice)
+ }
+
func confirmActiveSelection(uid: String?, name: String?) {
- let previousUID = self.lastConfirmedInputUID
let previousName = self.lastConfirmedInputName
self.lastConfirmedInputUID = uid
self.lastConfirmedInputName = name ?? previousName
@@ -208,32 +233,8 @@ final class MicrophonePreferenceCoordinator: ObservableObject {
"Confirmed active microphone as '\(name ?? "none")'",
source: "MicrophonePreferenceCoordinator"
)
- if let startupNoticePresentedUID = self.startupNoticePresentedUID,
- uid != startupNoticePresentedUID
- {
- MicrophoneChangeOverlayController.shared.show(
- MicrophoneChangeNotice(
- previousName: self.startupNoticePresentedName,
- currentName: name,
- presentation: .activeChange
- )
- )
- }
return
}
- guard uid != previousUID else { return }
-
- let notice = MicrophoneChangeNotice(
- previousName: previousName,
- currentName: name,
- presentation: .activeChange
- )
- DebugLogger.shared.info(
- "Active microphone changed from '\(notice.previousName ?? "none")' " +
- "to '\(notice.currentName ?? "none")' after first PCM",
- source: "MicrophonePreferenceCoordinator"
- )
- MicrophoneChangeOverlayController.shared.show(notice)
}
func markActiveSelectionUnavailable() {
@@ -288,8 +289,6 @@ final class MicrophonePreferenceCoordinator: ObservableObject {
else { return }
self.startupNoticeTask = nil
self.didPresentStartupNotice = true
- self.startupNoticePresentedUID = expectedUID
- self.startupNoticePresentedName = currentName
MicrophoneChangeOverlayController.shared.show(
MicrophoneChangeNotice(
previousName: nil,
diff --git a/Sources/Fluid/Views/AutomaticDictionaryCorrectionOverlay.swift b/Sources/Fluid/Views/AutomaticDictionaryCorrectionOverlay.swift
index 5efa4fcd..f1e2ea0b 100644
--- a/Sources/Fluid/Views/AutomaticDictionaryCorrectionOverlay.swift
+++ b/Sources/Fluid/Views/AutomaticDictionaryCorrectionOverlay.swift
@@ -228,6 +228,7 @@ final class DictionaryCorrectionOverlayController {
enum MicrophoneChangePresentation: Hashable {
case startupSelection
+ case selectionChange
case activeChange
}
@@ -487,6 +488,9 @@ private struct MicrophoneChangeOverlayView: View {
if self.notice.presentation == .startupSelection {
return "FluidVoice will try this microphone first when you dictate."
}
+ if self.notice.presentation == .selectionChange {
+ return "FluidVoice selected this microphone for capture."
+ }
return "FluidVoice confirmed this microphone is capturing audio."
}
}