I am using the file “Interop.SpeechLib.dll” for Text to Speech.
Public WithEvents vox As New SpVoice
Private Sub btnToRead_Click(…
vox.Speak(txtToRead.Text , SpeechVoiceSpeakFlags.SVSFlagsAsync)
End Sub
Private Sub btnPause_Click(…
vox.Pause()
End Sub
Private Sub btnResume_Click(…
vox.Resume()
End Sub
Private Sub btnStopRead_Click(…
vox.Speak(“”, SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak) ’ For Stop
End Sub
The above code runs fine.
But if I want the btnStopRead to be enabled until the text is read, then I have to change the code a little
btnStopRead.Enabled = True
vox.Speak(txtToRead.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync)
vox.WaitUntilDone(…)
btnStopRead.Enabled = False
OR
btnStopRead.Enabled = True
vox.Speak(txtToRead.Text , SpeechVoiceSpeakFlags.SVSFDefault)
btnStopRead.Enabled = False
But when I use this code, the Pause, Resume, Stop buttons are not working properly.
btnStopRead.Enabled = True
vox.Speak(txtToRead.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync)
btnStopRead.Enabled = False
This code does not work properly.
Can anyone provide any solution?
Thanks