Jump to content
  • Advertisement
Sign in to follow this  
Xoonaka

Using SAPI 5.1 In Game and Trouble with Loading

This topic is 4708 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm mostly new to these forums so I hope this would be the appropriate place for my inquiry. Basically, I'm a student doing a research project on implementing Speech Recognition into games for an easier experience with the UI. The problem I've run into is with loading a Grammar into the SAPI. I've tried two of the four methods provided, those two being LoadCmdFromResource and LoadCmdFromFile. Both of these were done in spec with the documentation, however I can't seem to get them to load the grammar. Both return a similar HRESULT, something to the effect of not being able to load the resource. Specifically, the File loading one returns "The system cannot find the file specified." and the resource one returns "The specified resource type cannot be found in the image file". The only thing I can figure is I must be doing something blantantly simple wrong, otherwise it would work like it's supposed to. After doing some searching on Google, I've found a couple people have had similar problems and didn't receive any responses on different forums, and I thought I might have some luck here. Here's a posting of my initialization code for SAPI: //////////////// CODE START //////////////// m_hWnd = hWnd; HRESULT hr = S_OK; hr = m_cpEngine.CoCreateInstance(CLSID_SpInprocRecognizer); //CLSID_SpSharedRecognizer for shared use hr = m_cpEngine->CreateRecoContext(&m_cpRecoCtxt); // Sets up the message to be used for the processing hr = m_cpRecoCtxt->SetNotifyWindowMessage(m_hWnd, WM_RECOEVENT, 0, 0); // Sets it so only the Recognition message is sent hr = m_cpRecoCtxt->SetInterest(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION)); hr = m_cpRecoCtxt->CreateGrammar(GRAMMARID1, &m_cpCmdGrammar); // Loads Grammar from a resource hr = m_cpCmdGrammar->LoadCmdFromResource( NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), L"SRGRAMMAR", MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL), SPLO_DYNAMIC ); // Loads it from a file //hr = m_cpCmdGrammar->LoadCmdFromFile((WCHAR *)szFilename, SPLO_STATIC ); // Explicitly states the state of the rules which are normally defined in the XML hr = m_cpCmdGrammar->SetRuleState( NULL, NULL, SPRS_ACTIVE ); //////////////// CODE END //////////////// As you can see, I currently am loading from a resource and have the load from file commented out, but I would prefer to load from a file if possible. If anyone has any ideas, please let me know. Even if I can't finish this in time to turn it in, I'd still like to try and get it into my Final Project. Thanks for your time!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You may look onto this sapi 5 tutorials:
http://www.generation5.org/articles.asp?Action=List&Topic=Speech%20Recognition

it worked for me

greetings

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!