none
用过microsoft speech sdk的朋友帮忙解决一些问题,谢谢 RRS feed

  • 问题

  • 用过microsoft speech sdk的朋友帮忙解决一些问题,谢谢

    是这样的 我在winform中添加引用microsoft speech object

    后在cs文件中using SpeechLib;

     

    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";
    
      }
    
     }
    }
    
    

    会得到label.Text的值

     

    但是在aspx.cs中这样使用就不行了

    namespace myspeak
    {
     public partial class MySpeak : System.Web.UI.Page
     {
      public delegate void MySpeakHandler();
      public event MySpeakHandler Viseme;
    
      SpeechLib.SpVoice Voice = new SpVoiceClass(); 
      protected void Page_Load(object sender, EventArgs e)
      {
       Voice.Viseme += new _ISpeechVoiceEvents_VisemeEventHandler(Voice_Viseme);
      }
    
      void Voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
      {
       
       Label1.Text += "Voice_Viseme:" + CurrentVisemeId.ToString();
    
      }
    
      protected void Button1_Click1(object sender, EventArgs e)
      {
       Voice.Speak("hello", SpeechVoiceSpeakFlags.SVSFlagsAsync);
      }
    
      
     }
    }
    
    

    始终得不到

     Label1.Text的值啊 <
    br
    />
    
    < br />
    各路朋友,专家 帮帮忙谢谢啦
     Label1.Text

     

     

     

     

    然后

     

     

    2010年7月22日 8:58

全部回复

  • 用过microsoft speech sdk的朋友帮忙解决一些问题,谢谢

    是这样的 我在winform中添加引用microsoft speech object

    后在cs文件中using SpeechLib;

     

    然后

    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";
    
        }
    
      }
    }
    

     

    会得到label.Text的值

     

    但是在aspx.cs中这样使用就不行了

    namespace myspeak
    {
      public partial class MySpeak : System.Web.UI.Page
      {
        public delegate void MySpeakHandler();
        public event MySpeakHandler Viseme;
    
        SpeechLib.SpVoice Voice = new SpVoiceClass(); 
        protected void Page_Load(object sender, EventArgs e)
        {
          Voice.Viseme += new _ISpeechVoiceEvents_VisemeEventHandler(Voice_Viseme);
        }
    
        void Voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
        {
          
          Label1.Text += "Voice_Viseme:" + CurrentVisemeId.ToString();
    
        }
    
        protected void Button1_Click1(object sender, EventArgs e)
        {
          Voice.Speak("hello", SpeechVoiceSpeakFlags.SVSFlagsAsync);
        }
    
       
      }
    }
    
    
    始终得不到

     Label1.Text的值啊 <br/>
    <br/>
    各路朋友,专家 帮帮忙谢谢啦
    
     Label1.Text
    

     

    2010年7月22日 8:37