I have a program I'm building that has multiple text-to-speech fields in it (seven to be exact) that all talk, one at a time, in a sequence.
After a bit of experimentation, I can now get the program to sequentially revSpeak what's in field 1, then send a mouseUp to a button when revIsSpeaking() is false to start the next field talking, and so forth, until all the text-to-speech fields have spoken in the correct order. The problem is getting all seven of those fields to all stop right away if I want to abort, rather than letting all the text completely finish speaking.
Here is basically what the code looks like in each button that plays one of the text-to-speech fields and then sends a "mouseUp" to the next button. By the way, the whole reason for having different text-to-speech fields is so that I have control over the speed and pitch of the speech in each of those fields, so it can sound like a conversation between a couple of different speakers:
Code: Select all
revSpeak word 1 to -1 of field "TalkField1" wait until revIsSpeaking() is true--the wait until false didn't work unless I preceded it with the wait until true wait until revIsSpeaking() is false with messages--it seems to work best if I include "with messages" revStopSpeech send "mouseUp" to button "speechSpeedButton2"-- this button changes the speed of the voice and then sends a "mouseUp" command to "2TalkField" that is basically identical to the script for "TalkField1" above
The only way I can get the program to stop talking is by pressing the revStopSpeech button seven times or so before it finally completely stops. I'm assuming the problem is possibly due to pendingMessages, but am not really sure because I'm new to the pendingMessages concept, or if that's even the correct command to use.
I also keep experimenting with flushEvents and exit to top, but haven't gotten anything to work yet except for pressing the button seven times.
I am using Windows 10 and LiveCode 7.06.
Any advice along these lines would be greatly appreciated.
All the best,