Synchronization Problem for SAPI or (text to speech ) … C#

前端 未结 2 796
攒了一身酷
攒了一身酷 2021-01-28 03:12

I\'m working on a project which will speak the content of browsed web page.Browser is made by me using WebControl. I\'m using SAPI for speech engine. I wanted to highlight the l

2条回答
  •  孤独总比滥情好
    2021-01-28 04:14

    get all the sentences into one string, and call the speak just once. replace ur for loop with below:

    string str1 = "";
    for (int i = 0; i < splitSentences.Length; i++) 
    { 
         str1 += highlight(splitSentences[i]); 
    }
    sound_object.Speak(str1, SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync);
    

    hope this helps!

提交回复
热议问题