Speaking of voices

Ken Norris pixelbird at interisland.net
Wed Jul 2 02:28:00 EDT 2003


Hi Jim,

> Date: Tue, 1 Jul 2003 08:51:01 -0700
> From: Jim Hurley <jhurley at infostations.com>
> Subject: Re: Speaking of voices

> I confess I didn't follow what you are saying here. Why would one
> need to set the stop condition first?
----------
See below.
----------
> Without the line:
> 
> RevSetSpeechVoice "Bruce",
> 
> the mouseUP handler works as expected.
>
> It would appear that that
> line affects the conditional statement that follows. Why is that
> normal AFAIK behavior?
----------
Well, if I'm right, the explanation might be a little hard to follow, so
hang in there.

According to the docs, the line in question (RevSetSpeechVoice "Bruce")
cannot change voices while speech is already happening in a given session,
i.e., if you _were_ changing voices, which it must account for even if you
don't. 

Therefore, "revSetSpeechVoice" behaves like the beginning of a sequence at
every encounter in the current session, meaning it's going to shut off any
running speech when it sets the voice. This is "normal" in this case.

Thus, setting the voice _first_ causes the current speech to stop in
preparation for the next revSpeak command. After the line executes, there is
no more speech, i.e., revIsSpeaking() is FALSE. You can check this in the
message box.

Your handler:

on mouseUP
  revsetspeechVoice "Bruce"
       ## Kills the speech

    if revIsSpeaking() then
      revstopSpeech
          ## revIsSpeaking is now FALSE because the first line
          ## already killed speech.

    else revspeak me
       ## Will always start speaking at the beginning.

end mouseUP

So, if you simply re-sequence the handler like this:

on mouseUP
  if revIsSpeaking() then
    revstopSpeech
  else 
    revsetspeechVoice "Bruce"
    revspeak me
  end if
end mouseUP

...it works. Actually, since we know that 'revSetSpeechVoice' kills speech,
technically, we could use the same line in place of 'revStopSpeech':

on mouseUP
  if revIsSpeaking() then
    revsetspeechVoice "Bruce"
  else 
    revsetspeechVoice "Bruce"
    revspeak me
  end if
end mouseUP

...also works...if you can think of a reason to use it this way.

> And, of course, what does the acronym mean?
> :-)
----------
AFAIK = As Far As I Know.

HTH,
Ken N.




More information about the use-livecode mailing list