Article View: comp.sys.mac
Article #14197Sample Macintalk program (Lightspeed C)
From: William H. Jefferys
Date: Thu, 15 Jan 1987 15:05
Date: Thu, 15 Jan 1987 15:05
55 lines
2037 bytes
2037 bytes
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 <MacinTalk.h>
#include <MemoryMgr.h>
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();
}
Technical Details
Message-ID:
<1520@utastro.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!utastro!billShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!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