Important: Inside Macintosh: Sound is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.
StopSpeechAt
You can use theStopSpeechAt
function to terminate speech delivery on a specified channel either immediately or at the end of the current word or sentence.
FUNCTION StopSpeechAt (chan: SpeechChannel; whereToStop: LongInt) : OSErr;
chan
- The speech channel on which speech is to be stopped.
whereToStop
- A constant indicating when speech processing should stop. Pass the constant
kImmediate
to stop immediately, even in the middle of a word. PasskEndOfWord
orkEndOfSentence
to stop speech at the end of the current word or sentence, respectively.DESCRIPTION
TheStopSpeechAt
function halts the production of speech on the channel specified bychan
at a specified point in the text. This routine returns immediately, although speech output continues until the specified point has been reached.
If the end of the input text buffer is reached before the specified stopping point, the speech synthesizer stops at the end of the buffer without generating an error.
- WARNING
- If you call the
StopSpeechAt
function before the Speech Manager finishes processing input text, then the function might return before some input text has yet to be spoken. Thus, before disposing of the text buffer, your application should wait until its text-done callback procedure has been called (if one has been defined), or until it can determine (by, for example obtaining a speech status information record) that the Speech Manager is no longer processing input text.SPECIAL CONSIDERATIONS
Because theStopSpeechAt
function might move or purge memory, you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theStopSpeechAt
function are
Trap macro Selector _SoundDispatch
$0430000C RESULT CODES
noErr 0 No error invalidComponentID -3000 Speech channel is uninitialized or bad