|
|
@ -11,7 +11,6 @@ import io.flutter.plugin.common.MethodChannel |
|
|
import io.flutter.plugin.common.MethodChannel.MethodCallHandler |
|
|
import io.flutter.plugin.common.MethodChannel.MethodCallHandler |
|
|
import io.flutter.plugin.common.MethodChannel.Result |
|
|
import io.flutter.plugin.common.MethodChannel.Result |
|
|
import io.flutter.plugin.common.EventChannel |
|
|
import io.flutter.plugin.common.EventChannel |
|
|
import com.microsoft.cognitiveservices.speech.audio.* |
|
|
|
|
|
import com.deep_voice.speech.tts.TtsEvent |
|
|
import com.deep_voice.speech.tts.TtsEvent |
|
|
import com.deep_voice.speech.tts.TtsEventListener |
|
|
import com.deep_voice.speech.tts.TtsEventListener |
|
|
import com.deep_voice.speech.tts.TtsEventType |
|
|
import com.deep_voice.speech.tts.TtsEventType |
|
|
@ -356,30 +355,32 @@ class AzureSpeechPlugin : BleService.Callback, FlutterPlugin { |
|
|
|
|
|
|
|
|
"renameFile" -> { |
|
|
"renameFile" -> { |
|
|
|
|
|
|
|
|
val filePath = call.argument<String>("filePath")?: "" |
|
|
val filePath = call.argument<String>("filePath") ?: "" |
|
|
val newName = call.argument<String>("newName")?: "" |
|
|
val newName = call.argument<String>("newName") ?: "" |
|
|
try { |
|
|
try { |
|
|
FileLogger.d(tag, "音频文件名称为: ${filePath}") // |
|
|
FileLogger.d(tag, "音频文件名称为: ${filePath}") // |
|
|
azureAsrHelper.renameFile(filePath,newName) |
|
|
azureAsrHelper.renameFile(filePath, newName) |
|
|
result.success(true) |
|
|
result.success(true) |
|
|
} catch (e: Exception) { |
|
|
} catch (e: Exception) { |
|
|
result.error("ENABLERECORD_ERROR", e.message, null) |
|
|
result.error("ENABLERECORD_ERROR", e.message, null) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
"moveFile" -> { |
|
|
"moveFile" -> { |
|
|
val sourcePath = call.argument<String>("sourcePath")?: "" |
|
|
val sourcePath = call.argument<String>("sourcePath") ?: "" |
|
|
val destPath = call.argument<String>("destPath")?: "" |
|
|
val destPath = call.argument<String>("destPath") ?: "" |
|
|
try { |
|
|
try { |
|
|
FileLogger.d(tag, "音频文件名称为: ${sourcePath}") // |
|
|
FileLogger.d(tag, "音频文件名称为: ${sourcePath}") // |
|
|
|
|
|
|
|
|
azureAsrHelper.moveFile(sourcePath,destPath) |
|
|
azureAsrHelper.moveFile(sourcePath, destPath) |
|
|
result.success(true) |
|
|
result.success(true) |
|
|
} catch (e: Exception) { |
|
|
} catch (e: Exception) { |
|
|
result.error("ENABLERECORD_ERROR", e.message, null) |
|
|
result.error("ENABLERECORD_ERROR", e.message, null) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
"enableRecord" -> { |
|
|
"enableRecord" -> { |
|
|
val filePath = call.argument<String>("filePath")?: "" |
|
|
val filePath = call.argument<String>("filePath") ?: "" |
|
|
try { |
|
|
try { |
|
|
FileLogger.d(tag, "音频文件名称为: ${filePath}") // |
|
|
FileLogger.d(tag, "音频文件名称为: ${filePath}") // |
|
|
|
|
|
|
|
|
@ -389,12 +390,14 @@ class AzureSpeechPlugin : BleService.Callback, FlutterPlugin { |
|
|
result.error("ENABLERECORD_ERROR", e.message, null) |
|
|
result.error("ENABLERECORD_ERROR", e.message, null) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
"pauseRecord" -> { |
|
|
"pauseRecord" -> { |
|
|
azureAsrHelper.pauseRecord() |
|
|
azureAsrHelper.pauseRecord() |
|
|
result.success(true) |
|
|
result.success(true) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
"stopRecord" -> { |
|
|
"stopRecord" -> { |
|
|
val isSave = call.argument<Boolean>("isSave")?:false |
|
|
val isSave = call.argument<Boolean>("isSave") ?: false |
|
|
try { |
|
|
try { |
|
|
azureAsrHelper.stopRecord(isSave) |
|
|
azureAsrHelper.stopRecord(isSave) |
|
|
result.success(true) |
|
|
result.success(true) |
|
|
|