Interface: ISpeechVoiceStatus
LastStreamNumberQueued Property
The LastStreamNumberQueued property retrieves the number of the last audio stream enqueued by the voice.
Syntax
Set: | (This property is read-only) |
Get: | Long = ISpeechVoiceStatus.LastStreamNumberQueued |
Parts
- ISpeechVoiceStatus
- The owning object.
- Long
-
Set: (This property is read-only)
Get: A Long variable returning the stream number of the last audio stream spoken.
Example
The following code snippet demonstrates the use of the LastStreamNumberQueued property. To run this code, create a form with the following control:
- A command button called Command1
Paste this code into the Declarations section of the form.
The Form_Load procedure creates a voice object. The Command1_Click procedure speaks three streams asynchronously, creates an ISpeechVoiceStatus object and prints the LastStreamNumberQueued property value. The WaitUntilDone method then blocks execution until the voice finishes speaking the three streams, and the LastStreamNumberQueued property value is printed again. The value of the LastStreamNumberQueued property in both cases is 3.
Option Explicit
Private V As SpeechLib.SpVoice
Private S As SpeechLib.ISpeechVoiceStatus
Private Sub Command1_Click()
On Error GoTo EH
'Enqueue three streams
V.Speak "this is stream number one.", SVSFlagsAsync
V.Speak "a second stream, now.", SVSFlagsAsync
V.Speak "the third stream is next", SVSFlagsAsync
'Get status while voice is speaking
Set S = V.Status 'Get status thru ISpeechVoiceStatus object
Print "Voice is speaking and LastStreamNumberQueued is " _
& S.LastStreamNumberQueued
DoEvents 'Let Print results be seen immediately
V.WaitUntilDone (99999) 'Wait until voice finishes
'Get status thru "Voice.Status.Property" syntax
Print "Voice is finished and LastStreamNumberQueued is " _
& V.Status.LastStreamNumberQueued
EH:
If Err.Number Then ShowErrMsg
End Sub
Private Sub Form_Load()
Set V = New SpVoice
End Sub
Private Sub ShowErrMsg()
' Declare identifiers:
Dim T As String
T = "Desc: " & Err.Description & vbNewLine
T = T & "Err #: " & Err.Number
MsgBox T, vbExclamation, "Run-Time Error"
End
End Sub