rhdunn / espeak

eSpeak NG is an open source speech synthesizer that supports 101 languages and accents.
http://reecedunn.co.uk/espeak-for-android
GNU General Public License v3.0
386 stars 16 forks source link

How to stop my program untill espeak ends speaking? #123

Open rezaee opened 6 years ago

rezaee commented 6 years ago

Let's consider I have a for(;;) loop, it gets a new string by every iteration, and passes it to system("espeak") like this:


for(;;)
{
   string str = getNewString();
   string str2 = "espeak '" +str+ "'";
   system(str2.c_str());
}

But when the first str passes to espeak it starts to say it, but before it ends the speaking, for loop runs again and passes a new string and it crashes.

I am looking a way, my program pauses the for loop untill the espeak done! Is it possible? How?