|
|
|
@ -668,6 +668,7 @@ class AzureSpeechPlugin : BleService.Callback, FlutterPlugin { |
|
|
|
"initialize" -> { |
|
|
|
val subscriptionKey = call.argument<String>("subscriptionKey") ?: "" |
|
|
|
val region = call.argument<String>("region") ?: "" |
|
|
|
val language = call.argument<String>("language") ?: "zh-CN" |
|
|
|
val useCustomAudioOutput = |
|
|
|
call.argument<Boolean>("useCustomAudioOutput") ?: false |
|
|
|
|
|
|
|
@ -677,7 +678,7 @@ class AzureSpeechPlugin : BleService.Callback, FlutterPlugin { |
|
|
|
ttsAppId = "", // Azure TTS不需要appId |
|
|
|
ttsAppToken = subscriptionKey, |
|
|
|
ttsResource = region, |
|
|
|
language = "zh-CN" |
|
|
|
language = language |
|
|
|
) |
|
|
|
|
|
|
|
// 如果初始化成功且需要使用自定义音频输出,则设置自定义音频播放器 |
|
|
|
@ -703,6 +704,13 @@ class AzureSpeechPlugin : BleService.Callback, FlutterPlugin { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
"setSpeechParams" -> { |
|
|
|
val rate = call.argument<Int>("rate") ?: 0 |
|
|
|
val pitch = call.argument<Int>("pitch") ?: 0 |
|
|
|
val volume = call.argument<Int>("volume") ?: 100 |
|
|
|
result.success(azureTtsHelper.setSpeechParams(rate = rate, pitch = pitch, volume = volume)) |
|
|
|
} |
|
|
|
|
|
|
|
"setVoice" -> { |
|
|
|
val voiceName = call.argument<String>("voiceName") |
|
|
|
?: return result.error("INVALID_ARGUMENTS", "语音名称不能为空", null) |
|
|
|
|