Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 4 - Speech Manager / Speech Manager Reference
Speech Manager Routines / Starting, Stopping, and Pausing Speech


Legacy Documentclose button

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 the StopSpeechAt 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. Pass kEndOfWord or kEndOfSentence to stop speech at the end of the current word or sentence, respectively.
DESCRIPTION
The StopSpeechAt function halts the production of speech on the channel specified by chan at a specified point in the text. This routine returns immediately, although speech output continues until the specified point has been reached.

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.
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.

SPECIAL CONSIDERATIONS
Because the StopSpeechAt function might move or purge memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the StopSpeechAt function are
Trap macroSelector
_SoundDispatch$0430000C

RESULT CODES
noErr0No error
invalidComponentID-3000Speech channel is uninitialized or bad

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996