如何在SAPI Engine中处理暂停事件

时间:2016-01-22 00:21:00

标签: sapi

我目前已经实施了SAPI语音,效果很好。我想知道当应用程序调用ISpVoice-> Pause时如何处理引擎中的Pause事件。

2 个答案:

答案 0 :(得分:2)

尽我所知,ISpVoice::Pause完全在SAPI层实现,并且不会进行任何引擎调用。

答案 1 :(得分:1)

我试图准确理解你的最终目标是什么,但我想我会采取措施来回答这个问题。

对于语音,根据MSDN暂停执行以下操作:

ISpVoice ::暂停 暂停最近警报边界的语音并关闭输出设备,允许访问其他语音的待处理发言请求。

假设您已经使用SPF_AYSNC发言,您可能还必须设置事件兴趣和警报边界here

示例显示处理书签警报边界

'Create a Normal Priority voice - male
Set objHIM = New SpVoice
Set objHIM.Voice = objHIM.GetVoices("gender=male").Item(0)

objHER.Speak "the priority of this voice is S V P alert"
objHIM.Speak "the priority of this voice is S V P normal"

objHIM.EventInterests = SVEBookmark     'Receive bookmark events only
objHIM.AlertBoundary = SVEPhoneme       'Let alert voices interrupt words

'Normal voice speaks text which generates events.

strSpeak = "This is text  that contains bookmarks " _
            & "for the  purpose of generating events."

objHIM.Speak strSpeak, SVSFIsXML + SVSFlagsAsync