Canceling Multiple revSpeak Commands

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm
Location: Las Vegas, NV

Canceling Multiple revSpeak Commands

Post by deeverd » Thu Jan 21, 2016 11:37 pm

Hello Forum,

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"
   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
So basically, using the above code, I'm not having any luck at is getting revStopSpeech to work with one press of the button and stop the program from wanting to read from all the remaining text-to-speech fields.

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,

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”