0
我想安裝一個碳API的回調函數,但它不起作用:事件正確觸發它(當它完成講話時),但它返回分段錯誤11而不是打印「......已完成」。回調函數與碳API
下面的代碼:
...
/* 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.");
};
我想我沒有正確安裝回調函數?