0
我正在使用voce语音识别API是为Java和C++构建的。以下是我的代码没有输出..没有错误
#include "C:/Users/yohan/Documents/voce-0.9.1/src/c++/voce.h"
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
voce::init("C:/Users/yohan/Documents/voce-0.9.1/lib", true, false, "", "");
voce::synthesize("This is a speech synthesis test.");
voce::synthesize("Type a message to hear it spoken aloud.");
std::cout << "This is a speech synthesis test. "
<< "Type a message to hear it spoken aloud." << std::endl;
std::cout << "Type 's' + 'enter' to make the "
<< "synthesizer stop speaking. Type 'q' + 'enter' to quit."
<< std::endl;
std::string s;
while (s != "q")
{
// Read a line from keyboard.
std::getline(std::cin, s);
if ("s" == s)
{
voce::stopSynthesizing();
}
else
{
// Speak what was typed.
voce::synthesize(s);
}
}
voce::destroy();
// system("pause");
return 0;
}
当我运行此代码时,我什么都没有!没有错误,没有输出,只是控制台窗口打开,并说“按返回退出”,这就是全部!以下是得到了印在QT控制台消息
Starting C:\Users\yohan\Documents\QTPeojects\Tired-build-Desktop_Qt_5_0_0_beta2_MSVC2010_32bit_SDK-Release\release\Tired.exe...
C:\Users\yohan\Documents\QTPeojects\Tired-build-Desktop_Qt_5_0_0_beta2_MSVC2010_32bit_SDK-Release\release\Tired.exe exited with code 0
的voce.h是一个API文件,你可以从这里得到它。这个头文件使用Jni将Java代码转换为C++。 http://sourceforge.net/p/voce/code/HEAD/tree/src/c++/
请帮忙!
你需要调用setRecognizerEnabled吗?另外,在你调用voce :: synthesize之后,尝试调用isSynthesizing,看看它是否返回true。最后,作为一个控制台应用程序,我建议从命令行运行,而不是从您正在使用的IDE中启动。 – TheDarkKnight 2013-04-30 07:43:59