2013-04-29 3 views
0

Java 및 C++ 용으로 작성된 음성 인식 API voce 음성 인식 API를 사용하고 있습니다. 아래 코드는출력 없음 오류 없음

#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; 
} 

이 코드를 실행하면 아무 것도 얻을 수 없습니다. 오류도 출력도없고, 콘솔 창을 열고 "press return exit"라고 말하면 그게 전부입니다! 메시지가 voce.h는 API 파일입니다

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 

QT 콘솔에 인쇄 받고 있습니다 다음, 당신은 여기에서 할 수 있습니다. 이 헤더 파일은 Jni를 사용하여 Java 코드를 C++로 변환합니다. http://sourceforge.net/p/voce/code/HEAD/tree/src/c++/

도와주세요!

+0

setRecognizerEnabled를 호출해야합니까? 또한 voce :: synthesize를 호출 한 후 isSynthesizing을 호출하여 true를 반환하는지 확인하십시오. 마지막으로, 콘솔 응용 프로그램을 사용하면 IDE에서 실행하는 것이 아니라 명령 줄에서 실행하는 것이 좋습니다. – TheDarkKnight

답변

0

디버거에서 실행 해보십시오. 귀하의 메인에서 첫 번째 라인은 아마도 실패하고 그냥 출구 (0)를 호출합니다. 디버그 문을 위에 올려 놓으십시오.

행운을 빈다. 희망이 도움이됩니다.

편집 : 또한 라이브러리 호출에 대해 적절한 오류 검사를 수행해야합니다. 때로는 함수 호출의 반환 값을 확인하기 만하면 trycatch 블록이나 다른 시간이 필요할 수도 있습니다.