Go to the documentation of this file.00001 #ifndef _ROSPEEX_INTERFACE_H_
00002 #define _ROSPEEX_INTERFACE_H_
00003
00004 #include <string>
00005 #include <boost/shared_ptr.hpp>
00006 #include <boost/function.hpp>
00007 #include <boost/algorithm/string.hpp>
00008
00009 namespace rospeex
00010 {
00011
00012
00013 typedef boost::function<void(const std::string&)> SpeechSynthesisCallback;
00014 typedef boost::function<void(const std::string&)> SpeechRecognizeCallback;
00015
00019 class Interface
00020 {
00021 public:
00025 Interface();
00026
00030 virtual ~Interface();
00031
00039 bool init( bool ss_enable=true, bool sr_enable=true, bool spi_enable=true );
00040
00056 void say( const std::string& msg,
00057 const std::string& language = "ja",
00058 const std::string& engine = "nict",
00059 const std::string& voice_font = "*" );
00060
00077 void tts( const std::string& msg,
00078 const std::string& file,
00079 const std::string& language = "ja",
00080 const std::string& engine = "nict",
00081 const std::string& voice_font = "*" );
00082
00090 void recognize( const std::string& data,
00091 const std::string& language = "ja",
00092 const std::string& engine = "nict" );
00093
00099 void registerSRResponse( const SpeechRecognizeCallback& callback );
00100
00106 void registerSRResponse( void(*fp)(const std::string& msg) );
00107
00113 void registerSSResponse( const SpeechSynthesisCallback& callback );
00114
00120 void registerSSResponse( void(*fp)(const std::string& data) );
00121
00128 void setSPIConfig( const std::string& language="ja", const std::string& engine="nict");
00129
00134 void playSound( const std::string& file_name );
00135
00136 private:
00140 class Impl;
00141 boost::shared_ptr<Impl> impl_;
00142 };
00143
00144 };
00145
00146
00147
00148 #endif // _ROSPEEX_INTERFACE_H_