如何检测 SAPI TTS 引擎何时繁忙

发布于 2024-07-15 11:14:34 字数 272 浏览 4 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

被你宠の有点坏 2024-07-22 11:14:35

例如,在 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.

梦旅人picnic 2024-07-22 11:14:35

来自 http://msdn.microsoft.com/ en-us/library/ee431864%28v=vs.85%29.aspx

SPRUNSTATE 列出语音运行状态。

typedef enum SPRUNSTATE
{
    SPRS_DONE,
    SPRS_IS_SPEAKING
} 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.

typedef enum SPRUNSTATE
{
    SPRS_DONE,
    SPRS_IS_SPEAKING
} SPRUNSTATE;

Elements:

SPRS_DONE
The voice has completed processing all queued streams.
SPRS_IS_SPEAKING
The voice instance currently has the audio claimed.

‘画卷フ 2024-07-22 11:14:34

这是了解语音合成系统是否在说话的解决方案。

<代码> 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."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文