【发布时间】:2013-12-12 06:30:51
【问题描述】:
我正在尝试使用 carbon API 安装一个回调函数,但它不起作用:它被事件正确触发(当它完成讲话时)但它返回一个 分段错误 11而不是打印“...完成。”。
代码如下:
...
/* Creates SpeechChannel */
SpeechChannel speechchannel;
NewSpeechChannel(NULL,&speechchannel);
/* Sets callback */
CFNumberRef cbf = CFNumberCreate (
NULL,
kCFNumberLongType,
MySpeechDoneProc
);
OSErr error1;
error1 = SetSpeechProperty (speechchannel,kSpeechSpeechDoneCallBack,cbf);
/* Speaks it */
OSErr error2;
error2 = SpeakCFString(speechchannel, finalString, NULL);
...
后来有:
void MySpeechDoneProc (SpeechChannel chan,long refCon)
{
printf("...Finished.");
};
我猜我没有正确安装回调函数?
【问题讨论】:
标签: macos callback text-to-speech macos-carbon