Browse Source

Merge commit '888839e17de279c78ef3125520d6ee8d17fdd22c' into new_dev

newdev_shunjiawei
lxm 1 year ago
parent
commit
8bdae1742f
  1. 44
      lib/modules/settings/views/settings_view.dart
  2. 24
      local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrToAsr.kt

44
lib/modules/settings/views/settings_view.dart

@ -514,28 +514,28 @@ class SettingsView extends GetView<SettingsController> {
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
//BLE测试
_buildSimpleNavigationSetting(
title: 'opus解码测试',
subtitle: '测试opus解码',
icon: Icons.bluetooth_searching,
iconBgColor: isDarkMode
? Colors.green[900]!.withOpacity(0.3)
: Colors.green[100]!,
iconColor:
isDarkMode ? Colors.green[300]! : Colors.green[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
Get.toNamed(Routes.opusTest);
},
isDarkMode: isDarkMode,
),
Divider(
height: 1,
color: isDarkMode
? Colors.white.withOpacity(0.1)
: Colors.grey[200]),
// //BLE测试
// _buildSimpleNavigationSetting(
// title: 'opus解码测试',
// subtitle: '测试opus解码',
// icon: Icons.bluetooth_searching,
// iconBgColor: isDarkMode
// ? Colors.green[900]!.withOpacity(0.3)
// : Colors.green[100]!,
// iconColor:
// isDarkMode ? Colors.green[300]! : Colors.green[600]!,
// titleColor: isDarkMode ? Colors.white : null,
// subtitleColor: isDarkMode ? Colors.white70 : null,
// onTap: () {
// Get.toNamed(Routes.opusTest);
// },
// isDarkMode: isDarkMode,
// ),
// Divider(
// height: 1,
// color: isDarkMode
// ? Colors.white.withOpacity(0.1)
// : Colors.grey[200]),
// BLE测试
// _buildSimpleNavigationSetting(

24
local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrToAsr.kt

@ -1090,12 +1090,28 @@ fun getSupportedLanguages(): List<String> {
try {
Log.d(TAG, "开始清理服务资源")
// 停止连续识别
if (serviceState.isRecognizing.get()) {
stopContinuousTranslation()
// 停止连续识别(避免调用异步 stopContinuousTranslation 后立刻 reset 导致被取消)
runCatching { serviceState.isRecognizing.set(false) }
try {
recognizer?.stopContinuousRecognitionAsync()
?.get(1500, java.util.concurrent.TimeUnit.MILLISECONDS)
} catch (t: Throwable) {
Log.w(TAG, "清理阶段停止识别器超时或失败", t)
}
// 添加协程清理
// 停止录音线程(打断并短等待退出)
runCatching { audioProcessor?.stopRecording() }
.onFailure { Log.w(TAG, "清理阶段停止录音失败", it) }
// 关闭录音文件(若有)
runCatching { recordfile1?.closeFile(true) }
.onFailure { Log.w(TAG, "清理阶段关闭录音文件失败", it) }
// 清理翻译/合成状态位(不额外等待,避免阻塞主线程)
serviceState.isTranslating.set(false)
serviceState.isSynthesizing.set(false)
// 添加协程清理(放在资源停止之后,避免取消正在进行的停止协程)
resetCoroutineScope()
// 清理识别器

Loading…
Cancel
Save