Browse
 
Tools
Rss Categories

SimpleRecognizer.h

Reference Number: AA-01515 Views: 1872 0 Rating/ Voters

C++ Code

  1. #ifndef SIMPLE_RECOGNIZER_H
  2. #define SIMPLE_RECOGNIZER_H
  3. #include "AudioStreamer.h"
  4. #include <LVSpeechPort.h>
  5.  
  6. class SimpleRecognizer
  7. {
  8. public:
  9. SimpleRecognizer();
  10. ~SimpleRecognizer();
  11. void WaitUntilDone();
  12. void LoadGrammar(const std::string& grammar_name,
    const std::string& grammar_location);
  13. void Recognize(AudioStreamer* Stream, const std::string& grammar_name);
  14. const std::string& GetResult();
  15. private:
  16. static void PortCB(int NewState, unsigned int TotalBytes,
    unsigned int RecordedBytes, void* UserData);
  17. static bool AudioCB(char* audio_data, int audio_data_size, void* user_data);
  18. bool finished_decode;
  19. AudioStreamer* AudioThread;
  20. LVSpeechPort port;
  21. int voiceChannel;
  22. void GetAnswers();
  23. std::string result;
  24. };

  25. #endif // SIMPLE_RECOGNIZER_H