|
|
|
@ -103,7 +103,6 @@ class AgentServiceImpl: NSObject { |
|
|
|
private let maxIdleSeconds: TimeInterval = 5 |
|
|
|
var micCapture: MicrophoneCapture! |
|
|
|
// 语音识别模式 |
|
|
|
private var lastRecognitionMode: String = "normal" |
|
|
|
public var currentRecognitionMode: String = "normal" |
|
|
|
// 识别结果 |
|
|
|
private var recognitionResult = "" |
|
|
|
@ -509,11 +508,6 @@ class AgentServiceImpl: NSObject { |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
lastRecognitionMode = currentRecognitionMode |
|
|
|
if (lastRecognitionMode == "ble_wakeup" && mode != "ble_wakeup"){//之前是唤醒模式,现在不是唤醒模式 |
|
|
|
os_log("liwei------- 关闭唤醒通道", log: logger, type: .info) |
|
|
|
BleService.shared.closeCodec() |
|
|
|
} |
|
|
|
stopRecognition() |
|
|
|
if isAiStreaming { |
|
|
|
isAiStreaming = false |
|
|
|
@ -535,6 +529,13 @@ class AgentServiceImpl: NSObject { |
|
|
|
os_log("liwei--------------- 设置语音识别模式: %{public}@", log: logger, type: .info, mode) |
|
|
|
|
|
|
|
let audioSourceType: AzureAsrHelper.AudioSourceType = useBle ? .external : .microphone |
|
|
|
|
|
|
|
if useBle { |
|
|
|
// AudioSessionHub.shared.begin(.playback) |
|
|
|
} else { |
|
|
|
//AudioSessionHub.shared.begin(.voice) |
|
|
|
} |
|
|
|
|
|
|
|
// 新增:标记为"启动中",用于允许 stop 在启动未完成时也能生效 |
|
|
|
isStartingRecognition = true |
|
|
|
|
|
|
|
|