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 cancelled preview handoff
altic-devb0a04178419a
diff --git a/Sources/Fluid/Services/ASRService.swift b/Sources/Fluid/Services/ASRService.swiftindex c0688010..200e5297 100644--- a/Sources/Fluid/Services/ASRService.swift+++ b/Sources/Fluid/Services/ASRService.swift@@ -1642,11 +1642,11 @@ final class ASRService: ObservableObject {self.audioLevelSubject.send(0)}- private func handOffMicrophonePreviewToCaptureStartIfNeeded() {+ private func handOffMicrophonePreviewToCaptureStartIfNeeded() -> Bool {guard self.isMicrophonePreviewRequested ||self.isMicrophonePreviewActive ||self.audioCapturePipeline.isLevelMonitoringEnabled- else { return }+ else { return false }// Invalidate preview ownership without stopping Core Audio. The direct// lifecycle serializes any in-flight preview start, and recording can@@ -1657,6 +1657,17 @@ final class ASRService: ObservableObject {self.isMicrophonePreviewActive = falseself.microphonePreviewError = nilself.audioLevelSubject.send(0)+ return true+ }++ private func stopHandedOffMicrophonePreviewAfterCancelledStart() async {+ self.audioCapturePipeline.setRecordingEnabled(false)+ _ = await self.directAudioLifecycleController.stop(+ retainPrepared: true,+ reason: "cancelled_microphone_preview_handoff"+ )+ self.activeAudioCaptureBackend = .none+ self.audioLevelSubject.send(0)}func openSystemSettingsForMic() {@@ -1712,7 +1723,7 @@ final class ASRService: ObservableObject {// Reserve the start before relinquishing preview ownership so a// press-and-hold release can cancel the handoff. Keep the running input// alive; startConfiguredAudioCapture reuses it for zero-stop first PCM.- self.handOffMicrophonePreviewToCaptureStartIfNeeded()+ let handedOffMicrophonePreview = self.handOffMicrophonePreviewToCaptureStartIfNeeded()// Reset media pause state for this sessionself.didPauseMediaForThisSession = false@@ -1722,6 +1733,9 @@ final class ASRService: ObservableObject {guard startGeneration == self.audioCaptureStartGeneration,self.isTerminating == falseelse {+ if handedOffMicrophonePreview {+ await self.stopHandedOffMicrophonePreviewAfterCancelledStart()+ }DebugLogger.shared.debug("Audio capture start cancelled during route handoff generation=\(startGeneration)",source: "ASRService"