i need help!!!
-
i have been tring to write a program that can perform common tasks by voice. i am using microsoft visual c++ 2005 express edition beta 2 (had other problems with so if anyone knows of anything better that is free, since i only do programming as a hobby right now, that would also help). i need help with the voice recognition. i have downloaded the microsoft speech sdk 5.1 and have tried the examples with it but when i try to compile the examples it gives me several errors. i have also searched this website and search engines for some help but i cannot find any thing that helps. the ones on this website helped a little bit but most of the code they used gave me errors such as undefined variables when i try to compile them. i dont know if there are other include files that i am forgetting or what. the include file sphelper.h also gives me several errors by itself when i try to include it in any program. i have also been trying to make a tree view control to display the list of commands from the xml file that i have so if anyone knows how to do this it would also help me out a lot. any help would be greatly appreciated (code samples and tutorials are extremly helpful) thank you in advance for the help. - Kyle
-
i have been tring to write a program that can perform common tasks by voice. i am using microsoft visual c++ 2005 express edition beta 2 (had other problems with so if anyone knows of anything better that is free, since i only do programming as a hobby right now, that would also help). i need help with the voice recognition. i have downloaded the microsoft speech sdk 5.1 and have tried the examples with it but when i try to compile the examples it gives me several errors. i have also searched this website and search engines for some help but i cannot find any thing that helps. the ones on this website helped a little bit but most of the code they used gave me errors such as undefined variables when i try to compile them. i dont know if there are other include files that i am forgetting or what. the include file sphelper.h also gives me several errors by itself when i try to include it in any program. i have also been trying to make a tree view control to display the list of commands from the xml file that i have so if anyone knows how to do this it would also help me out a lot. any help would be greatly appreciated (code samples and tutorials are extremly helpful) thank you in advance for the help. - Kyle
gr8coaster329 wrote:
but most of the code they used gave me errors such as undefined variables when i try to compile them.
Perhaps if you posted some code.....
gr8coaster329 wrote:
the include file sphelper.h also gives me several errors by itself when i try to include it in any program.
Each version of VC becomes more standards compliant. Perhaps the library is not compliant enough for VC2005 ?
gr8coaster329 wrote:
i have also been trying to make a tree view control to display the list of commands from the xml file that i have so if anyone knows how to do this it would also help me out a lot.
Which bit are you stuck with ? Christian Graus - Microsoft MVP - C++
-
gr8coaster329 wrote:
but most of the code they used gave me errors such as undefined variables when i try to compile them.
Perhaps if you posted some code.....
gr8coaster329 wrote:
the include file sphelper.h also gives me several errors by itself when i try to include it in any program.
Each version of VC becomes more standards compliant. Perhaps the library is not compliant enough for VC2005 ?
gr8coaster329 wrote:
i have also been trying to make a tree view control to display the list of commands from the xml file that i have so if anyone knows how to do this it would also help me out a lot.
Which bit are you stuck with ? Christian Graus - Microsoft MVP - C++
the code that i used i just copied and pasted from the articles:
typedef struct tag_key
{
int mid;
int pid;
int chd;
HTREEITEM hItem;
HTREEITEM hParent;
char txt[32];
char ref[128];
}KEY;KEY aKeys[NUMBER_OF_KEYS];
HRESULT CWebVoice::LoadGrammar()
{
USES_CONVERSION;
HRESULT hr;SPPROPERTYINFO pi;
ZeroMemory(&pi,sizeof(SPPROPERTYINFO));
pi.ulId = RID_MenuItem; // property ID
pi.vValue.vt = VT_UI4;// add menu items to the dynamic grammar rule
for(int i=0; i < m_nNumKeys; i++) {
pi.vValue.ulVal = i+1; // Property_Value == data_index + 1
hr=m_cpGrammar->AddWordTransition(hRule,NULL,
T2W(aKeys[i].txt),L" ",SPWT_LEXICAL,1,&pi);
if(FAILED(hr)) return hr;
}// add a wildcard phrase
pi.vValue.ulVal = 0;
hr=m_cpGrammar->AddWordTransition(hRule,
NULL, L"*", L" ", SPWT_LEXICAL, 1, &pi);
if(FAILED(hr)) return hr;hr=m_cpGrammar->Commit(NULL); if(FAILED(hr)) return hr;
hr=m_cpGrammar->SetGrammarState(SPGS_ENABLED); if(FAILED(hr)) return hr;
return hr;
}and other code from http://www.codeproject.com/audio/WebVoicePkg.asp[^] and http://www.codeproject.com/cs/media/tambiSR.asp[^] i dont know how to do any of the speech recognition code. all i know, from other articles, is that you have to initialize the sapi, load the grammar, and something with the recognition contex thing. i dont know how to do any of this or anything else with the voice recognition. and if not asking too much, how to display the UI's associated with the speech sdk, the user profile, mic training, user training, engine properties and the other ones like that. i have the buttons but dont know the code that displays them, i found the displayUI function but am not sure how to use it.
Christian Graus wrote:
Each version of VC becomes more standards compliant. Perhaps the library is not compliant enough for VC2005 ?
so what do i have to do to get it to work?
Christian Graus wrote:
Which bit are you stu
-
the code that i used i just copied and pasted from the articles:
typedef struct tag_key
{
int mid;
int pid;
int chd;
HTREEITEM hItem;
HTREEITEM hParent;
char txt[32];
char ref[128];
}KEY;KEY aKeys[NUMBER_OF_KEYS];
HRESULT CWebVoice::LoadGrammar()
{
USES_CONVERSION;
HRESULT hr;SPPROPERTYINFO pi;
ZeroMemory(&pi,sizeof(SPPROPERTYINFO));
pi.ulId = RID_MenuItem; // property ID
pi.vValue.vt = VT_UI4;// add menu items to the dynamic grammar rule
for(int i=0; i < m_nNumKeys; i++) {
pi.vValue.ulVal = i+1; // Property_Value == data_index + 1
hr=m_cpGrammar->AddWordTransition(hRule,NULL,
T2W(aKeys[i].txt),L" ",SPWT_LEXICAL,1,&pi);
if(FAILED(hr)) return hr;
}// add a wildcard phrase
pi.vValue.ulVal = 0;
hr=m_cpGrammar->AddWordTransition(hRule,
NULL, L"*", L" ", SPWT_LEXICAL, 1, &pi);
if(FAILED(hr)) return hr;hr=m_cpGrammar->Commit(NULL); if(FAILED(hr)) return hr;
hr=m_cpGrammar->SetGrammarState(SPGS_ENABLED); if(FAILED(hr)) return hr;
return hr;
}and other code from http://www.codeproject.com/audio/WebVoicePkg.asp[^] and http://www.codeproject.com/cs/media/tambiSR.asp[^] i dont know how to do any of the speech recognition code. all i know, from other articles, is that you have to initialize the sapi, load the grammar, and something with the recognition contex thing. i dont know how to do any of this or anything else with the voice recognition. and if not asking too much, how to display the UI's associated with the speech sdk, the user profile, mic training, user training, engine properties and the other ones like that. i have the buttons but dont know the code that displays them, i found the displayUI function but am not sure how to use it.
Christian Graus wrote:
Each version of VC becomes more standards compliant. Perhaps the library is not compliant enough for VC2005 ?
so what do i have to do to get it to work?
Christian Graus wrote:
Which bit are you stu
gr8coaster329 wrote:
m_cpGrammar
This is a member variable, have you created it ? If not, this code snippet will indeed give you the error you describe
gr8coaster329 wrote:
so what do i have to do to get it to work?
Use VC2003, if there's no VC2005 version, and assuming this is the problem. I would assume otherwise though.
gr8coaster329 wrote:
i have the xml document and the tree view control i just dont know how to get the contents of the xml put into the tree view.
Well, you need to iterate through the XML, I assume it's a tree shaped structure, or you'd just use a list box, right ? So, you need to use recursion to iterate through all the XML nodes, and then one by one add them to your tree. I'm sure there are plenty of articles out there on XML->tree ctrl ? If you've found a CP article, try compiling and running the code from the article, that gives you code that is known to work, and lets you debug your own environment. It also gives you a starting point to experiment and learn from. Also, try asking API specific questions in the forum for the article. I sure know nothing about the speech API. Christian Graus - Microsoft MVP - C++
-
gr8coaster329 wrote:
m_cpGrammar
This is a member variable, have you created it ? If not, this code snippet will indeed give you the error you describe
gr8coaster329 wrote:
so what do i have to do to get it to work?
Use VC2003, if there's no VC2005 version, and assuming this is the problem. I would assume otherwise though.
gr8coaster329 wrote:
i have the xml document and the tree view control i just dont know how to get the contents of the xml put into the tree view.
Well, you need to iterate through the XML, I assume it's a tree shaped structure, or you'd just use a list box, right ? So, you need to use recursion to iterate through all the XML nodes, and then one by one add them to your tree. I'm sure there are plenty of articles out there on XML->tree ctrl ? If you've found a CP article, try compiling and running the code from the article, that gives you code that is known to work, and lets you debug your own environment. It also gives you a starting point to experiment and learn from. Also, try asking API specific questions in the forum for the article. I sure know nothing about the speech API. Christian Graus - Microsoft MVP - C++
Christian Graus wrote:
This is a member variable, have you created it ? If not, this code snippet will indeed give you the error you describe
what all do i have to do to create it? i have never done this before i am still trying to learn programming in my spare time. thank you again for the help - Kyle
-
Christian Graus wrote:
This is a member variable, have you created it ? If not, this code snippet will indeed give you the error you describe
what all do i have to do to create it? i have never done this before i am still trying to learn programming in my spare time. thank you again for the help - Kyle
You're suffering from a common problem. You want to build the Eiffel Tower, and you're yet to build a sandcastle. Instead of copying and pasting code almost at random, you should buy a beginner book on C++, and work through it. Then, when you can interpret the code you're copying, you may have a shot at making it work. Yes, if we posted back and forth four more times, we might get past this problem, but it would not help you in the long run. You're biting off more than you can chew. Buy a book ( teach yourself C++ in 24 hours is a good one ), and ask questions here when you get stuck, but work through it. Then try a few simpler projects, before you start trying to manipulate COM objects and otherwise use more complex APIs. Christian Graus - Microsoft MVP - C++