File tree 1 file changed +24
-6
lines changed
speechInteraction/modules/googleSynthesis
1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class Processing : public yarp::os::BufferedPort<yarp::os::Bottle>
52
52
std::string language;
53
53
std::string voice;
54
54
double speed;
55
- double pitch;
55
+ double pitch;
56
56
yarp::os::RpcServer handlerPort;
57
57
yarp::os::Port syncPort;
58
58
@@ -229,10 +229,6 @@ class Module : public yarp::os::RFModule, public googleSynthesis_IDL
229
229
bool closing;
230
230
231
231
/* *******************************************************/
232
- bool attach (yarp::os::RpcServer &source)
233
- {
234
- return this ->yarp ().attachAsServer (source);
235
- }
236
232
237
233
public:
238
234
@@ -259,11 +255,33 @@ class Module : public yarp::os::RFModule, public googleSynthesis_IDL
259
255
/* now start the thread to do the work */
260
256
processing->open ();
261
257
262
- attach (rpcPort);
258
+ if (!attach (rpcPort)) {
259
+ yError ()<<" Cannot attach to rpc port" ;
260
+ return false ;
261
+ }
263
262
264
263
return true ;
265
264
}
266
265
266
+ bool respond (const yarp::os::Bottle& command, yarp::os::Bottle& reply) override
267
+ {
268
+ auto cmd0=command.get (0 ).asString ();
269
+ if (cmd0!=" say" )
270
+ {
271
+ reply.addString (" Command not recognized, please specify \" say <sentence>\" " );
272
+ return false ;
273
+ }
274
+
275
+ if (command.size ()>1 )
276
+ {
277
+ yarp::os::Bottle sentence_bot;
278
+ sentence_bot.addString (command.get (1 ).asString ());
279
+ processing->queryGoogleSynthesis (sentence_bot);
280
+ reply.addString (" ack" );
281
+ }
282
+
283
+ return yarp::os::RFModule::respond (command,reply);
284
+ }
267
285
/* *********************************************************/
268
286
bool close ()
269
287
{
You can’t perform that action at this time.
0 commit comments