You are reading help file online using chmlib.com
|
Interface: ISpeechVoiceStatus
The CurrentStreamNumber property retrieves the number of the text input stream being spoken by the text-to-speech (TTS) engine.
The CurrentStreamNumber property of an ISpeechVoiceStatus object is valid only when its RunningState property is SRSEIsSpeaking.
Set: | (This property is read-only) |
Get: | Long = ISpeechVoiceStatus.CurrentStreamNumber |
The following Visual Basic form code demonstrates the use of the CurrentStreamNumber and RunningState properties. To run this code, create a form with the following controls:
Paste this code into the Declarations section of the form.
The Form_Load procedure creates a voice. The Command1_Click procedure speaks three text streams asynchronously, putting each in the list box, and then performs a loop until the voice finishes speaking. Inside this loop, the code uses the CurrentStreamNumber property to highlight each line of text in the list box while it is spoken by the TTS engine. A RunningState property of SRSEDone indicates that the voice has finished speaking.
Option Explicit
Private V As SpeechLib.SpVoice
Private Sub Command1_Click()
Dim ii As Integer
List1.Clear
'Place text strings in the List box, and speak them
List1.AddItem "This is stream number one."
V.Speak "This is stream number one.", SVSFlagsAsync
List1.AddItem "A second stream, now."
V.Speak "A second stream, now.", SVSFlagsAsync
List1.AddItem "The third stream is next."
V.Speak "The third stream is next.", SVSFlagsAsync
'Check status periodically
Do
For ii = 0 To 1000
DoEvents
Next ii
'Highlight the stream being spoken
List1.ListIndex = V.Status.CurrentStreamNumber - 1
Loop Until V.Status.RunningState = SRSEDone 'Exit when voice stops
List1.ListIndex = -1 'Turn highlight off
End Sub
Private Sub Form_Load()
Set V = New SpVoice
End Sub
You are reading help file online using chmlib.com
|