SpeechWordProcPtr
Defines a pointer to a word callback functionthat is called by the Speech Synthesis Manager before it pronouncesa word.
Declaration
typealias SpeechWordProcPtr = (SpeechChannel, SRefCon, UInt, UInt16) -> VoidParameters
- chan:
The speech channel that has finished processing input text.
- refCon:
The reference constant associated with the speech channel.
- wordPos:
The number of bytes between the beginning of the text buffer and the beginning of the word about to be pronounced.
- wordLen:
The length in bytes of the word about to be pronounced.
Discussion
The Speech Synthesis Manager calls a speech channel’s wordcallback function just before it pronounces a word. You might usesuch a callback function, for example, to draw the word about tobe spoken in a window. In this case, the callback function wouldset a global flag variable to indicate that the word being spokenis changing and another two global variables to wordPos and wordLen.A function called by your application’s main event loop coulddetect that the word being spoken is changing and draw the wordin a window.
You can specify a word callback function by passing the soWordCallBack selectorto the SetSpeechInfo function.