diff --git a/VoiceInk/Recorder.swift b/VoiceInk/Recorder.swift index 6cc1d01..b683f7b 100644 --- a/VoiceInk/Recorder.swift +++ b/VoiceInk/Recorder.swift @@ -76,15 +76,7 @@ class Recorder: NSObject, ObservableObject, AVAudioRecorderDelegate { UserDefaults.standard.set(String(currentDeviceID), forKey: "lastUsedMicrophoneDeviceID") hasDetectedAudioInCurrentSession = false - - // Coordinate media control and system audio sequentially for better reliability - await playbackController.pauseMedia() - - // Small delay to allow media command to process before muting system audio - try? await Task.sleep(nanoseconds: 100_000_000) // 100ms - - _ = await mediaController.muteSystemAudio() - + let deviceID = deviceManager.getCurrentDevice() if deviceID != 0 { do { @@ -114,6 +106,12 @@ class Recorder: NSObject, ObservableObject, AVAudioRecorderDelegate { throw RecorderError.couldNotStartRecording } + Task { [weak self] in + guard let self = self else { return } + await self.playbackController.pauseMedia() + _ = await self.mediaController.muteSystemAudio() + } + audioLevelCheckTask?.cancel() audioMeterUpdateTask?.cancel() diff --git a/VoiceInk/Services/DictionaryContextService.swift b/VoiceInk/Services/DictionaryContextService.swift index 6e51b9a..9086112 100644 --- a/VoiceInk/Services/DictionaryContextService.swift +++ b/VoiceInk/Services/DictionaryContextService.swift @@ -6,7 +6,7 @@ class DictionaryContextService { private init() {} - private let predefinedWords = "VoiceInk, chatGPT, GPT-4o, GPT-5-mini, Kimi-K2, GLM V4.5, Claude, Claude 4 sonnet, Claude opus, ultrathink, Vibe-coding, groq, cerebras, gpt-oss-120B, Wispr flow, deepseek, gemini-2.5, Veo 3, elevenlabs, Kyutai" + private let predefinedWords = "VoiceInk, chatGPT, GPT-4o, GPT-5-mini, Kimi-K2, GLM V4.5, Claude, Claude 4 sonnet, Claude opus, ultrathink, Vibe-coding, groq, cerebras, gpt-oss-120B, deepseek, gemini-2.5, Veo 3, elevenlabs, Kyutai" func getDictionaryContext() -> String { var allWords: [String] = []