I'm developing a dictionary. I can listening for words in dictionary. if we quickly listening a lot of words. without listening the old words I cannot listen the currently selected word. So I am waiting listen to the selected word. '''
class Voicer1
{
public string read;
public SpVoice Sound_SV = new SpVoice();
public Thread th_WP;
public void Sound_Stp(string vocalist)
{
read = vocalist.ToString();
thread_Stp();
}
public void thread_Stp()
{
th_WP = new Thread(new ThreadStart(sound_1));
th_WP.Start();
}
public void sound_1()
{
Sound_SV.Speak(read.ToString(), SpeechVoiceSpeakFlags.SVSFDefault);
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
This is listening
Voicer1 Sound_1= new Voicer1();
Snd.Sound_Stp(label1.Text.ToString());
I use where necessary;
SoundPlayer stoprrr= new SoundPlayer();
stoprrr.Stop();
But this doesn't work.
Can you help me
I use; using System.Speech.Synthesis;
then, SpeechSynthesizer SSObj;
When I want to listen to the new word,
if (SSObj!= null)
{
SSObj.Dispose();
}
SSObj= new SpeechSynthesizer();
SSObj.SpeakAsync(read);
This method worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.