Dim str_Notice As String= args(0) \'定义传入参数1个
If BriSDKLib.QNV_PlayFile(Vars("intChannelID"),BriSDKLib.QNV_PLAY_FILE_ISPLAY,m_tagpstnData(Vars("intChannelID" )).lPlayFileHandle ,0,0) Then \' 如果播放句柄句柄一直有效,说明上一次的没播放完
StopPlayFile() \'则中断上一次的播放
End If
Dim Stream As new DotNetSpeech.SpFileStreamClass()
Stream.Open("Voice\\NoticeContent.wav",DotNetSpeech.SpeechStreamFileMode.SSFMCreateForWrite , False)
For Each v As object In sp.getVoices \'用for each循环找到名称包含 Lily的语音库
If v.GetDescription Like "*LiLy*" Then
sp.Voice = v
\'MessageBox.show(v.GetDescription) 经检查是获取到了的
Exit For
End If
Next
sp.AudioOutputStream = Stream \'使语音库的输出结果输出到 stream对应的上述*.wav语音文件 sp已在全局代码中定义过了,故这里不需要定义
System.threading.Thread.Sleep(1000)
sp.Speak(args(0),DotNetSpeech.SpeechVoiceSpeakFlags.SVSFDefault) \'同步播放 \'用args(0) 传递要播放的内容,此行录制要播放的内容到 .wav文件中
Stream.Close()
\'**********************************************************************************************
m_tagpstnData(Vars("intChannelID" )).lPlayFileHandle = BriSDKLib.QNV_PlayFile(Vars( "intChannelID" ),BriSDKLib.QNV_PLAY_FILE_START,0,0,"Voice\\NoticeContent.wav" ) \'播放通知内容语音 如果没有语音,则会直接挂机,请注意!
\'以下为循环检测播放句柄是否一直有效,播放完毕后就挂机
Do While BriSDKLib.QNV_PlayFile(Vars("intChannelID"),BriSDKLib.QNV_PLAY_FILE_ISPLAY,m_tagpstnData(Vars("intChannelID" )).lPlayFileHandle ,0,0) \' 播放句柄句柄一直有效
Application.DoEvents
Loop
If FileSys.FileExists( ProjectPath & "Voice\\NoticeContent.wav") Then \'如果指定的文件存在
FileSys.DeleteFile(ProjectPath & "Voice\\NoticeContent.wav",2,2) \'则彻底删除之
End If
BriSDKLib.QNV_PlayFile(Vars("intChannelID"),BriSDKLib.QNV_PLAY_FILE_STOP,m_tagpstnData(Vars("intChannelID" )).lPlayFileHandle ,0,0) \'停止文件播放
Return Nothing