SpeechDoneProcPtr
Defines a pointer to a speech-done callback functionwhich is called when the Speech Synthesis Manager finishes speakinga buffer of text.
Declaration
typealias SpeechDoneProcPtr = (SpeechChannel, SRefCon) -> VoidParameters
- chan:
The speech channel that has finished processing input text.
- refCon:
The reference constant associated with the speech channel.
Discussion
If a speech-done callback function is installed in a speechchannel, then the Speech Synthesis Manager calls this function whenit finishes speaking a buffer of text.
You can specify a speech-done callback function by passingthe soSpeechDoneCallBack selectorto the SetSpeechInfo function.
You might use a speech-done callback function if you needto update some visual indicator that shows what text is currentlybeing spoken. For example, suppose your application passes textbuffers to the Speech Synthesis Manager one paragraph at a time.Your speech-done callback function might set a global flag variableto indicate to the application that the Speech Synthesis Managerhas finished speaking a paragraph. When a function called by yourapplication’s main event loop checks the global flag variableand determines that it has been set, the function might ensure thatthe next paragraph of text is visible.
You might use a speech-done callback function to set a flagvariable that alerts the application that it should pass a new bufferof text to the Speech Synthesis Manager. If you do so, however,there might be a noticeable pause as the Speech Synthesis Manager switchesfrom processing one text buffer to another. Ordinarily, it is easierto achieve this goal by using a text-done callback function, asdescribed earlier.