@pandereto wrote:
I want to use windows speech (tts) in a app, currently it works but the call to “speak” is blocking so each time my app talks it gets freeze.
So i moved my talks to another thread, but this do not work as the tts object needs to be created inside the same thread that gets called.
If i understand correctly the ttspeak object needs to be created inside the threadedFunction function to be on the same thread? How can i create the ttspeak object inside the same thread that calls the comSpeak method?
Thanks!
#pragma once #include "ofMain.h" #include "ttspeak.h" class parlante : public ofThread { public: parlante() { startThread(); created = false; } //-------------------------------------------------------------- ~parlante() { waitForThread(true); } //-------------------------------------------------------------- void habla(string & text) { paraHablar.send(text); } //-------------------------------------------------------------- void init() { speechOut.loadComSpeak(100, FEMALE); } private: void threadedFunction() { string text; while (paraHablar.receive(text)) { speechOut.comSpeak(text); } } bool created; ttspeak speechOut; ofThreadChannel<string> paraHablar; };
Posts: 1
Participants: 1