Click here to Skip to main content
15,069,297 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:

I have created this program which loads a file into a rich textbox and sapi reads it from the richtextbox. Now, everything works as intended but now my goal is to pause / stop the reading using play/pause buttons. I am unable to do this and sapi keeps reading untill it gets done. I dont know where the problem is. I was looking online for some solutions and tried one of them but it dint seem to work.(https://www.daniweb.com/software-development/vbnet/threads/418673/microsoft-speech-api[^]

Here is my code:-

VB
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
       

        Me.RichTextBox1.LoadFile("c:\temp\Commands.txt", RichTextBoxStreamType.PlainText)

End sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        sapi.speak(RichTextBox1.Text)
        


    End Sub

 Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

      
        sapi.pause()

End Sub


How do i resolve this issue? Please help me out. Thanks
Posted
Updated 11-Nov-20 2:27am
v2
Comments
[no name] 27-Sep-14 17:04pm
   
Did you take care about "AlertBoundary"?
V.AlertBoundary = SVEPhoneme //Let words be interrupted

http://msdn.microsoft.com/en-us/library/ms723604(v=vs.85).aspx

1 solution

change
sapi.speak(RichTextBox1.Text)
to
sapi.speak(RichTextBox1.Text,audioplaymode.background)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900