23 #include "speechsynth_thread.h"
25 #include <alcore/alerror.h>
26 #include <alproxies/allauncherproxy.h>
27 #include <alproxies/altexttospeechproxy.h>
28 #include <interfaces/SpeechSynthInterface.h>
42 :
Thread(
"NaoQiSpeechSynthThread",
Thread::OPMODE_WAITFORWAKEUP),
59 AL::ALPtr<AL::ALLauncherProxy> launcher(
new AL::ALLauncherProxy(
naoqi_broker));
60 bool is_tts_available = launcher->isModulePresent(
"ALTextToSpeech");
62 if (!is_tts_available) {
63 throw Exception(
"NaoQi ALTextToSpeech is not available");
65 }
catch (AL::ALError &e) {
66 throw Exception(
"Checking ALTextToSpeech aliveness failed: %s", e.toString().c_str());
69 altts_ = AL::ALPtr<AL::ALTextToSpeechProxy>(
new AL::ALTextToSpeechProxy(
naoqi_broker));
80 speechsynth_if_ = NULL;
87 NaoQiSpeechSynthThread::stop_speech()
89 if (tts_task_id_ != -1) {
90 if (altts_->isRunning(tts_task_id_)) {
91 altts_->stop(tts_task_id_);
98 NaoQiSpeechSynthThread::say(
const char *text)
100 tts_task_id_ = altts_->say(text);
106 bool working = (tts_task_id_ != -1) && altts_->isRunning(tts_task_id_);
111 speechsynth_if_->
write();
116 NaoQiSpeechSynthThread::process_messages()