4

我需要为用户提供一种简单的方法,无需进入控制面板即可选择语音配置文件。我发现: Acoustic training using SAPI 5.3 Speech API 但没有示例且信息不完整。

我真的可以举个例子,如果有人有的话:)

4

2 回答 2

1

语音控制面板中旁边带有“复选框”的“默认”配置文件由注册表项确定:

[HKEY_CURRENT_USER\Software\Microsoft\Speech\RecoProfiles]
"DefaultTokenId"="HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\RecoProfiles\\Tokens\\{A32BEAC3-4442-4E13-B485-8A2DD7178794}"

我认为只有在 Windows 语音识别 GUI/控制面板启动时才会读取此配置设置。因此,仅直接修改此注册表值对于“在运行时”更改配置文件可能没有用。

要在运行时更改配置文件,您可能会考虑使用该SetRecoProfile函数。到达可以调用该函数的地步是一个涉及的主题,但是...

于 2010-11-18T02:28:17.880 回答
1

以下代码片段可能有助于选择识别配置文件。我还没有尝试以编程方式制作新的配置文件。

IEnumSpObjectTokens *pProfileEnum;
SpEnumTokens(SPCAT_RECOPROFILES, NULL, NULL, &pProfileEnum);

unsigned long l;
pProfileEnum->GetCount(&l);

for (int i = 0; i < (int) l; i++)
{
    CComPtr<ISpObjectToken> IT;
    pProfileEnum->Item(i, &IT);
    WCHAR *wptr;
    IT->GetId(&wptr);
    CSpDynamicString dstrDefaultName;
    SpGetDescription(IT, &dstrDefaultName);
    //Do something to select the profile withe the name you would like to use
}  


//Assuming IT is the profile you want to use, activat it by calling:
cpRecognizer->SetRecoProfile(IT);
于 2012-04-11T22:07:24.883 回答