Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!utastro!bill From: bill@utastro.UUCP (William H. Jefferys) Newsgroups: comp.sys.mac Subject: Sample Macintalk program (Lightspeed C) Message-ID: <1520@utastro.UUCP> Date: Thu, 15-Jan-87 10:05:53 EST Article-I.D.: utastro.1520 Posted: Thu Jan 15 10:05:53 1987 Date-Received: Fri, 16-Jan-87 01:20:44 EST Organization: U. Texas, Astronomy, Austin, TX Lines: 55 Lightspeed C v. 2.01 supports Macintalk with a library and header file. Thanks to some pointers from Dave Bursik (db@cbosgd.UUCP) and Tom Speeter (vax135!ths@clyde.UUCP) I was able to get a very simple program working under Lightspeed C that uses Macintalk. I used Simpletools to define the user interface and main event loop, but you can use any technique you want for this. The main ideas are from an article by Bob Perez in MacUser, March 1986, pp. 104-110 (his program is in Aztec C). Tom's article should be consulted for further information. Bill Jefferys University of Texas ------------- Rippety Tear Snip Snip -------------------------------- #include#include SpeechHandle theSpeech; Handle spOut; quitproc() { DisposHandle(spOut); /* Dispose of handles and */ SpeechOff(theSpeech); /* Turn Macintalk off before exiting. */ exit(0); } sayproc() { long len; char str[255]; strcpy(str,""); prompt("Type something to say.",str); /* Get a phrase */ len = (long)strlen(str); CtoPstr(str); Reader(theSpeech, str, len, spOut); /* Convert to phonemes */ MacinTalk(theSpeech, spOut); /* Say it. */ } main() { SpeechErr err; simpletools("Talk"); /* Initialize everything */ menu("File","Quit/Q",quitproc); /* Set up menus */ menu("Actions","Say/S",sayproc); spOut = NewHandle(0L); /* Allocate handle */ if((err = SpeechOn("\p",&theSpeech)) != noErr) exit(0); /* Turn Macintalk on */ for(;;) /* Main event loop */ simpleevents(); }