You are reading help file online using chmlib.com
|
Object: SpCustomStream
The BaseStream property gets and sets the base stream object in a custom stream.
Set: | SpCustomStream.BaseStream = IUnknown |
Get: | IUnknown = SpCustomStream.BaseStream |
The following Visual Basic form code demonstrates the use of the BaseStream property. To run this code, create a form with following control:
Paste this code into the Declarations section of the form.
The From_Load procedure creates two voice objects. The Command1 procedure creates a new custom stream, uses the CreateStreamOnHGlobal API to create a new genetic Istream object, and sets the Istream as the custom stream's BaseStream property. Finally, it uses the first voice to speak a phrase into the custom stream, and then plays back the custom stream audio with the second voice.
Option Explicit
Dim V1 As SpeechLib.SpVoice
Dim V2 As SpeechLib.SpVoice
Dim C As SpeechLib.SpCustomStream
Private Declare Function CreateStreamOnHGlobal Lib "Ole32.dll" ( _
ByVal hGlobal As Any, ByVal fDeleteOnRelease As Boolean, _
ByRef ppStream As IStream) As Long
Private Sub Command1_Click()
Dim GeneticIstream As SpeechLib.IStream
'Create a genetic Istream object,
'Use as custom stream's base stream
CreateStreamOnHGlobal 0&, True, GeneticIstream
Set C = New SpCustomStream
Set C.BaseStream = GeneticIstream
'Set custom stream as voice's output stream
'Make voice speak into the stream
Set V1.AudioOutputStream = C
V1.Speak "hello world"
'Seek to beginning of stream, and speak stream
C.Seek 0, SSSPTRelativeToStart
V2.SpeakStream C
End Sub
Private Sub Form_Load()
Set V1 = New SpVoice 'Creates a custom stream
Set V2 = New SpVoice 'Speaks the custom stream
End Sub
You are reading help file online using chmlib.com
|