I am trying to add the grammar in my speech recognition code in Windows SAPI using COM. While loading the grammar file using LoadCmdFromFile function it is getting failed even though I did exactly what windows sample code has done.
hr = cpEngine->CreateRecoContext(&cpRecoCtx);
hr = cpRecoCtx->CreateGrammar(1, &cpRecoGrammar);
if(FAILED(hr)){
MessageBox(hwnd, TEXT("CreateGrammar failed"), TEXT("error"), MB_OK);
DestroyWindow(hwnd);
}
hr = cpRecoGrammar->LoadCmdFromFile(L"email.xml", SPLO_DYNAMIC);
if(FAILED(hr)){
MessageBox(hwnd, TEXT("LoadCmdFromFile failed"), TEXT("error"), MB_OK);
DestroyWindow(hwnd);
}
After execution it logs the LoadCmdFromFile failed. Please help to resolve this.
New contributor
saurabh Deshpande is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.