如何检测 SAPI TTS 引擎何时繁忙
SAPI 引擎一次只能从一个应用程序渲染 TTS(我已使用 Windows SDK TTSApplication 示例的两个实例运行测试来验证这一点)。 我正在编写一个应用程序,其中需要检测 TTS 引擎当前是否正在说话(即在单独的应用程序的控制下,而不是我的应用程序)。
有谁知道如何以编程方式(在 C++ 中)检测 SAPI TTS 引擎繁忙/就绪状态? 我尝试过使用 ISpVoice::GetStatus(),但这似乎只适用于我自己的应用程序中的任何 TTS 活动。
谢谢。
The SAPI engine can only render TTS from one application at a time (I have run a test with two instances of the Windows SDK TTSApplication sample to verify this). I am writing an application in which I need to detect whether the TTS engine is currently speaking (i.e. under control of a separate application, not mine).
Does anyone know please how can I programmatically (in C++) detect the SAPI TTS engine busy/ready state? I have tried using ISpVoice::GetStatus() but that only seems to work for any TTS activity in my own application.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
例如,在 SAPI4 中,IVTxtAttributes::IsSpeaking 检索此类状态(如果引擎当前正在向某些音频设备播放样本)。
无论如何,IMO 通用 SAPI 引擎并不局限于一种应用程序。 我相信这种行为是“你的引擎”特有的。
For example in SAPI4, IVTxtAttributes::IsSpeaking retrieve such status (if engine is currently playing samples to some audio device).
Anyway IMO general SAPI engine is not limited to one application. I believe that this behaviour is 'your engine' specific.
来自 http://msdn.microsoft.com/ en-us/library/ee431864%28v=vs.85%29.aspx
SPRUNSTATE 列出语音运行状态。
元素:
SPRS_DONE
语音已完成处理所有排队的流。
SPRS_IS_SPEAKING
语音实例当前已声明音频。
From http://msdn.microsoft.com/en-us/library/ee431864%28v=vs.85%29.aspx
SPRUNSTATE lists the voice running states.
Elements:
SPRS_DONE
The voice has completed processing all queued streams.
SPRS_IS_SPEAKING
The voice instance currently has the audio claimed.
这是了解语音合成系统是否在说话的解决方案。
<代码> ISpVoice *pVoice;
hr = pVoice->GetStatus(& status, NULL);
if(status.dwRunningState == SPRS_IS_SPEAKING)
std::cout<< “语音合成系统正在说话。”
else
std::cout<< “语音合成系统没有说话。”
This is the solution to know whether the speech synthesis system is speaking or not.
ISpVoice *pVoice;
hr = pVoice->GetStatus(& status, NULL);
if(status.dwRunningState == SPRS_IS_SPEAKING)
std::cout<< "The Speech Synthesis System is speaking."
else
std::cout<< "The Speech Synthesis System is not speaking."