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