Revision 2e526a15 server/src/MiddlewareRSB.cpp
| server/src/MiddlewareRSB.cpp | ||
|---|---|---|
| 136 | 136 |
} |
| 137 | 137 |
|
| 138 | 138 |
//call a tts system to convert a string to an utterance |
| 139 |
Utterance MiddlewareRSB::tts_call(string text){
|
|
| 139 |
boost::shared_ptr<Utterance> MiddlewareRSB::tts_call(string text){
|
|
| 140 | 140 |
double tts_timeout = 1.0; //seconds. DO NOT CHANGE THIS! |
| 141 | 141 |
|
| 142 |
Utterance utterance; |
|
| 143 |
|
|
| 144 | 142 |
//build request |
| 145 | 143 |
boost::shared_ptr<std::string> request(new string(text)); |
| 146 | 144 |
|
| ... | ... | |
| 150 | 148 |
|
| 151 | 149 |
//try to fetch the result |
| 152 | 150 |
boost::shared_ptr<rst::audition::Utterance> utterance_ptr = future_ptr.get(tts_timeout); |
| 153 |
utterance = UtteranceRSB(*(utterance_ptr.get())); |
|
| 151 |
|
|
| 152 |
//done, return utterance ptr |
|
| 153 |
boost::shared_ptr<Utterance> utterance(new UtteranceRSB(*(utterance_ptr.get()))); |
|
| 154 |
printf("> done. got utterance (text=%s)\n",utterance->get_text().c_str());
|
|
| 155 |
return utterance; |
|
| 154 | 156 |
|
| 155 | 157 |
}catch(rsc::threading::FutureTimeoutException e){
|
| 156 | 158 |
printf("> error: tts_call timed out after %3.1f seconds.\n", tts_timeout);
|
| ... | ... | |
| 158 | 160 |
printf("> error: tts_call failed: %s\n", e.what());
|
| 159 | 161 |
} |
| 160 | 162 |
|
| 161 |
printf("> done. got utterance (text=%s)\n",utterance.get_text().c_str());
|
|
| 163 |
printf("> failed... got no utterance\n");
|
|
| 164 |
boost::shared_ptr<Utterance> utterance(new Utterance()); |
|
| 162 | 165 |
return utterance; |
| 163 | 166 |
} |
| 164 | 167 |
|
Also available in: Unified diff