voice 11072001

Signed-off-by: lilium-saber <WR364999428@hotmail.com>
GDN
lilium-saber 1 year ago
parent 80799ae956
commit 24095d15ba

@ -1,13 +1,11 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WpfApp2.ScnToJson; using WpfApp2.ScnToJson;
using WpfApp2.translationKey; using WpfApp2.translationKey;
using WpfApp2.transToNet; using WpfApp2.transToNet;
using WpfApp2.tools;
using WpfApp2.tools.translationKey;
namespace WpfApp2 namespace WpfApp2.tools
{ {
internal class AllClassAndInterfaceWellBeManipulatedInThisFileAndCallThroughFunction internal class AllClassAndInterfaceWellBeManipulatedInThisFileAndCallThroughFunction
{ {
@ -19,6 +17,7 @@ namespace WpfApp2
TranslationScnToJson scnjson = new TranslationScnToJson(); TranslationScnToJson scnjson = new TranslationScnToJson();
Messiah jsonnet = new jsonNet(); Messiah jsonnet = new jsonNet();
TempResource temp = new TempResource(); TempResource temp = new TempResource();
yieldVoice voice = new yieldVoice();
public void InputPrivateBaidu(string name, string id, string key) public void InputPrivateBaidu(string name, string id, string key)
{ {
@ -30,16 +29,6 @@ namespace WpfApp2
trin.InPutPrivate(name, list); trin.InPutPrivate(name, list);
} }
public bool OutExistsD()
{
return trstr.GetExistsD();
}
public bool OutExistsF(string name)
{
return trstr.GetExistsF(name);
}
public List<string> OutputNameList() public List<string> OutputNameList()
{ {
List<string> list = trstr.OutputTranslationNameList(); List<string> list = trstr.OutputTranslationNameList();
@ -67,11 +56,14 @@ namespace WpfApp2
{ {
scnjson.StopTrans(spa, dps); scnjson.StopTrans(spa, dps);
} }
public string NetBaiDu(string input) public string NetBaiDu(string input)
{ {
return jsonnet.RequestJsonBaiDu(input); return jsonnet.RequestJsonBaiDu(input);
} }
public string NetBaiDu(string input, List<Charactor> list)
{
return jsonnet.RequestJsonBaiDu(input, list);
}
public string NetAllBaiDu(string input, string srcl, string dstl, string aid, string kkey) public string NetAllBaiDu(string input, string srcl, string dstl, string aid, string kkey)
{ {
@ -87,6 +79,10 @@ namespace WpfApp2
{ {
return jsonnet.RequestJsonXunFei(input); return jsonnet.RequestJsonXunFei(input);
} }
public string NetXunFei(string input, List<Charactor> list)
{
return jsonnet.RequestJsonXunFei(input, list);
}
public string NetLanXunFei(string input, string srcl, string dstl) public string NetLanXunFei(string input, string srcl, string dstl)
{ {
@ -158,10 +154,10 @@ namespace WpfApp2
return temp.TempChoicGet(); return temp.TempChoicGet();
} }
public void OutPutVoice(string text, string lan)
{
voice.CreateVoice(text, lan);
}
} }
} }

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows;
using Windows.Media.SpeechSynthesis;
using System.Speech.Synthesis;
namespace WpfApp2.tools.translationKey
{
internal class yieldVoice//
{
private string language = "zh-CN";
public async void CreateVoice(string temp, string lan)
{
await Task.Delay(TimeSpan.FromSeconds(1));//延迟1s
var syn = new System.Speech.Synthesis.SpeechSynthesizer();
var bui = new PromptBuilder();
syn.SetOutputToDefaultAudioDevice();
lan ??= language;
bui.StartVoice(new System.Globalization.CultureInfo(lan));
bui.AppendText(temp);
bui.EndVoice();
syn.Speak(bui);
}
}
}

@ -1,36 +0,0 @@
主窗口:
<MenuItem
Header=" 设置"
Height="20"
Width="50"
Name="设置"
BorderBrush="Gray">
<MenuItem Header="选择公共翻译接口" Click="TransSourceSelectWnd_loaded"/>
<MenuItem Header="选择私有翻译接口" Click="TransSourceSelectPri"/>
<MenuItem Header="写入私有翻译接口" Click="TransSourceInWindow"/>
</MenuItem>
private void TransSourceSelectWnd_loaded(object sender, RoutedEventArgs e)
{
var window = new TranslationSourceSelect();
window.ShowDialog();
}
private void PrograssSelectWnd_loaded(object sender, RoutedEventArgs e)
{
var window = new ProgressSelect();
window.ShowDialog();
}
private void TransSourceInWindow(object sender, RoutedEventArgs e)
{
var window = new TransSourceInWindow();
window.ShowDialog();
}
private void TransSourceSelectPri(object sender, RoutedEventArgs e)
{
var windows = new TransSourceSelectPri();
windows.ShowDialog();
}
Loading…
Cancel
Save