Revision 888a909b server/src/MiddlewareRSB.cpp
| server/src/MiddlewareRSB.cpp | ||
|---|---|---|
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
//call a tts system to convert a string to an utterance |
| 150 |
boost::shared_ptr<Utterance> MiddlewareRSB::tts_call(string text){
|
|
| 150 |
std::shared_ptr<Utterance> MiddlewareRSB::tts_call(string text){
|
|
| 151 | 151 |
double tts_timeout = 1.0; //seconds. DO NOT CHANGE THIS! |
| 152 | 152 |
|
| 153 | 153 |
//build request |
| 154 |
boost::shared_ptr<std::string> request(new string(text));
|
|
| 154 |
std::shared_ptr<std::string> request(new string(text));
|
|
| 155 | 155 |
|
| 156 | 156 |
//try to fetch it asynchronously: |
| 157 | 157 |
try{
|
| 158 | 158 |
RemoteServer::DataFuture<rst::audition::Utterance> future_ptr = tts_server->callAsync<rst::audition::Utterance>("create_utterance", request);
|
| 159 | 159 |
|
| 160 | 160 |
//try to fetch the result |
| 161 |
boost::shared_ptr<rst::audition::Utterance> utterance_ptr = future_ptr.get(tts_timeout);
|
|
| 161 |
std::shared_ptr<rst::audition::Utterance> utterance_ptr = future_ptr.get(tts_timeout);
|
|
| 162 | 162 |
|
| 163 | 163 |
//done, return utterance ptr |
| 164 |
boost::shared_ptr<Utterance> utterance(new UtteranceRSB(*(utterance_ptr.get())));
|
|
| 164 |
std::shared_ptr<Utterance> utterance(new UtteranceRSB(*(utterance_ptr.get())));
|
|
| 165 | 165 |
printf("> done. got utterance (text=%s)\n",utterance->get_text().c_str());
|
| 166 | 166 |
return utterance; |
| 167 | 167 |
|
| ... | ... | |
| 172 | 172 |
} |
| 173 | 173 |
|
| 174 | 174 |
printf("> failed... got no utterance\n");
|
| 175 |
boost::shared_ptr<Utterance> utterance(new Utterance());
|
|
| 175 |
std::shared_ptr<Utterance> utterance(new Utterance());
|
|
| 176 | 176 |
return utterance; |
| 177 | 177 |
} |
| 178 | 178 |
|
Also available in: Unified diff