我在asp.net中用了这个引擎,
等客户端post过来的txt内容,
我在defautl.aspx.cs里面这样写代码:using SpeechLib;
public partial class Default2 : System.Web.UI.Page
{
SpVoice voice = new SpVoice();
string str = "";
protected void Page_Load(object sender, EventArgs e)
{
} protected void Button1_Click(object sender, EventArgs e)
{
voice.Viseme +=new _ISpeechVoiceEvents_VisemeEventHandler(voice_Viseme);
voice.Speak(TextBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
}
void voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature,
SpeechVisemeType CurrentVisemeId)
{
str += CurrentVisemeId.ToString();
Session["str"] = str;
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = Session["str"].ToString(); }
}
但这样始终得不到结果啊
在winform里面使用委托很简答的就实现了
例如:
using SpeechLib;namespace pro2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SpeechLib.SpVoice Voice = new SpVoiceClass();
private void Form1_Load(object sender, EventArgs e)
{
Voice.Viseme += new _ISpeechVoiceEvents_VisemeEventHandler(Voice_Viseme);
}
private void button1_Click(object sender, EventArgs e)
{
Voice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
} void Voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
{
label1.Text += "CurrentVisemeId:" + CurrentVisemeId.ToString() + "\n";
} }
}winform 里面很快就出来了
。
所以各位朋友
麻烦告诉我 在asp.net中如何去获取事件被触发后的相应结果
或者是这个Spvoice类调用speak后事件被触发的相应结果。
谢谢
等客户端post过来的txt内容,
我在defautl.aspx.cs里面这样写代码:using SpeechLib;
public partial class Default2 : System.Web.UI.Page
{
SpVoice voice = new SpVoice();
string str = "";
protected void Page_Load(object sender, EventArgs e)
{
} protected void Button1_Click(object sender, EventArgs e)
{
voice.Viseme +=new _ISpeechVoiceEvents_VisemeEventHandler(voice_Viseme);
voice.Speak(TextBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
}
void voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature,
SpeechVisemeType CurrentVisemeId)
{
str += CurrentVisemeId.ToString();
Session["str"] = str;
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = Session["str"].ToString(); }
}
但这样始终得不到结果啊
在winform里面使用委托很简答的就实现了
例如:
using SpeechLib;namespace pro2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SpeechLib.SpVoice Voice = new SpVoiceClass();
private void Form1_Load(object sender, EventArgs e)
{
Voice.Viseme += new _ISpeechVoiceEvents_VisemeEventHandler(Voice_Viseme);
}
private void button1_Click(object sender, EventArgs e)
{
Voice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
} void Voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
{
label1.Text += "CurrentVisemeId:" + CurrentVisemeId.ToString() + "\n";
} }
}winform 里面很快就出来了
。
所以各位朋友
麻烦告诉我 在asp.net中如何去获取事件被触发后的相应结果
或者是这个Spvoice类调用speak后事件被触发的相应结果。
谢谢
改写成桌面程序吧。
我的意思是服务器方先接受客户端post过来的数据(相当于发送),然后在服务器先取得数据,再在服务器里面处理再返回客户端 这样的话可能需要两个监听端口,
客户端和服务器端的都要写发送和接收 我写得很烂 所以程序运行时候等待了大半天。各路朋友,专家,请给点方法,建议谢谢。
我的意思是服务器方先接受客户端post过来的数据(相当于发送),然后在服务器先取得数据,再在服务器里面处理再返回客户端 这样的话可能需要两个监听端口,
客户端和服务器端的都要写发送和接收 我写得很烂 所以程序运行时候等待了大半天。各路朋友,专家,请给点方法,建议谢谢。