1,105,295 Community Members

Microsoft Speech api

Member Avatar
Darkone
Newbie Poster
3 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I am having a problem and that is I have buttons to read text to speech like play pause and stop

I have created 4 buttons Play,Pause,Stop,Resume
but now I dont want the Resume button, instead when I click on the pause button it should pause the speech and later when I click the same button again I need the speach to be resumed
this is what I wrote
I know this is chilish then also I am not getting it plz help ASAP !

Public SAPI = CreateObject("SAPI.spvoice")

Private Sub startSpeaking_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startSpeaking.Click
    SAPI.speak(RichTextBox1.Text, 3)
    findHighlight(TextBox1.Text)
End Sub

Private Sub pauseSpeech_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pauseSpeech.Click
    SAPI.Pause()
End Sub

Private Sub stopSpeech_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopSpeech.Click
    SAPI.Speak(vbNullString, 2)
    'SAPI = Nothing
End Sub

Private Sub resumeSpeech_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resumeSpeech.Click
    SAPI.Resume()
End Sub
Member Avatar
Begginnerdev
Veteran Poster
1,141 posts since Apr 2010
Reputation Points: 251 [?]
Q&As Helped to Solve: 191 [?]
Skill Endorsements: 15 [?]
 
1
 

Declare a boolean variable at the top of the class.

public Paused as Boolean = false
'When you fire your click event do this;
If Paused = false Then
    'Pause code here
    Paused = true
ElseIf Paused = True Then
    'Unpause code here.
    Paused = False
End If
Member Avatar
Darkone
Newbie Poster
3 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks a lot for helping me !

Member Avatar
Darkone
Newbie Poster
3 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks a lot for helping me !

Member Avatar
Begginnerdev
Veteran Poster
1,141 posts since Apr 2010
Reputation Points: 251 [?]
Q&As Helped to Solve: 191 [?]
Skill Endorsements: 15 [?]
 
0
 

Np, friend. Don't forget to marked the thread as solved. :)

Question Answered as of 2 Years Ago by Begginnerdev
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: