GotSpeech.NET

The online community for Microsoft Speech Server developers
Welcome to GotSpeech.NET Sign in | Join | Help
in Search
Gold Systems

Can't initialize ISpRecoContext

Last post 02-18-2010, 5:07 PM by jconde. 1 replies.
Sort Posts: Previous Next
  •  02-08-2010, 10:21 AM 10040

    Can't initialize ISpRecoContext

    Hello, i'm trying to make a simple speech recognition program using SAPI 5.1. However, it fails to initialize recognition context. When i'm trying to launch SAPI C++ samples, like dictation pad, they fail to initialize too. Guess it's because of recognition context. 

    It could be because my windows has russian interface, but recognizer engine starts successfully. The code is below:

    int _tmain(int argc, _TCHAR* argv[])
    {
     
    if (FAILED(::CoInitialize(NULL)))
    return FALSE;

     
    HRESULT hr = S_OK;
     


    CComPtr<ISpRecognizer> Engine;
    hr = Engine.CoCreateInstance(CLSID_SpSharedRecognizer);
    if ( FAILED( hr ) ){ // Покидаем приложение
    MessageBoxA(0, "Unable to initialize recognition engine","Error",0);
    return FALSE;
    }


     
    CComPtr<ISpRecoContext> Context;
    hr = Engine->CreateRecoContext(&Context);
    if ( FAILED( hr ) ){ //Покидаем приложение
    MessageBoxA(0,"Unable to initialize recognition context", "Error", 0);
    return FALSE;
    }

     
    ::CoUninitialize();
    pVoice->Release();
    Engine->Release
    pVoice = NULL;
    return TRUE;
    }


    What's the problem?

    Thanks in advance
     


  •  02-18-2010, 5:07 PM 10092 in reply to 10040

    Re: Can't initialize ISpRecoContext

    You should look at the value it returns in hr when it fails to initialize, it may be telling you exactly why it's failing.

    At a guess I'd say it's probably the language that's the problem. Are you hoping for an English speech recognizer or a Russian one? Is it Russian Windows or English Windows with Cyrillic support patched in? It's a bit of a mess for non English users generally, but you may want to look here:

              http://msdn.microsoft.com/en-us/goglobal/bb978454.aspx

     You'll need to dig a bit for XP relevant information but it is there. I don't know offhand if a Russian speech recognizer exists for 5.1 though.

     

    John 

     

     

View as RSS news feed in XML