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
00055 void say( const std::string& msg,
00056 const std::string& language = "ja",
00057 const std::string& engine = "nict",
00058 const std::string& voice_font = "*" );
00059
00075 void tts( const std::string& msg,
00076 const std::string& file,
00077 const std::string& language = "ja",
00078 const std::string& engine = "nict",
00079 const std::string& voice_font = "*" );
00080
00088 void recognize( const std::string& data,
00089 const std::string& language = "ja",
00090 const std::string& engine = "nict" );
00091
00097 void registerSRResponse( const SpeechRecognizeCallback& callback );
00098
00104 void registerSRResponse( void(*fp)(const std::string& msg) );
00105
00111 void registerSSResponse( const SpeechSynthesisCallback& callback );
00112
00118 void registerSSResponse( void(*fp)(const std::string& data) );
00119
00126 void setSPIConfig( const std::string& language="ja", const std::string& engine="nict");
00127
00132 void playSound( const std::string& file_name );
00133
00134 private:
00138 class Impl;
00139 boost::shared_ptr<Impl> impl_;
00140 };
00141
00142 };
00143
00144
00145
00146 #endif // _ROSPEEX_INTERFACE_H_