X chat("",voicemode,voicepitch,voicerate,LAST_CALL);
X exittoshell();
X}
X
Xnop()
X{
X}
X
Xset_pitch()
X{
X int err, tmp;
X char answer[255];
X
X zerostr(answer);
X showwindow(pitchdialogptr);
X drawdialog(pitchdialogptr);
X do
X {
X modaldialog(NULL,&myitemhit);
X } while (myitemhit != OKITEM3);
X getditem(pitchdialogptr,GENTEXTITEM,&itemtype,&itemhandle,&disprect);
X getitext(itemhandle,&answer);
X setitext(itemhandle,"");
X tmp = atoi(answer);
X hidewindow(pitchdialogptr);
X if ((tmp < 69) || (tmp > 450))
X {
X paramtext("Pitch","69\311450","","");
X alert(708,NULL);
X }
X else
X {
X voicepitch = tmp;
X speechpitch(thespeech,voicepitch,(short)voicemode);
X menu("Speech","Reset to defaults^4",itemenable);
X }
X}
X
Xset_rate()
X{
X int err, tmp;
X char answer[255];
X
X zerostr(answer);
X showwindow(ratedialogptr);
X drawdialog(ratedialogptr);
X do
X {
X modaldialog(NULL,&myitemhit);
X } while (myitemhit != OKITEM3);
X getditem(ratedialogptr,GENTEXTITEM,&itemtype,&itemhandle,&disprect);
X getitext(itemhandle,&answer);
X setitext(itemhandle,"");
X hidewindow(ratedialogptr);
X tmp = atoi(answer);
X if ((tmp < 85) || (tmp > 425))
X {
X paramtext("Rate","85\311425","","");
X alert(708,NULL);
X }
X else
X {
X voicerate = tmp;
X speechrate(thespeech,voicerate);
X menu("Speech","Reset to defaults^4",itemenable);
X }
X}
X
Xset_natural_mode()
X{
X voicemode = natural;
X menu("Speech","Robotic Speech",itemuncheck);
X menu("Speech","Natural Speech",itemcheck);
X menu("Speech","Reset to defaults^4",itemenable);
X}
X
Xset_robotic_mode()
X{
X voicemode = robotic;
X menu("Speech","Robotic Speech",itemcheck);
X menu("Speech","Natural Speech",itemuncheck);
X menu("Speech","Reset to defaults^4",itemenable);
X}
X
Xreset_settings()
X{
X voicemode = natural;
X menu("Speech","Robotic Speech",itemuncheck);
X menu("Speech","Natural Speech",itemcheck);
X voicepitch = DEFPITCH;
X voicerate = DEFRATE;
X menu("Speech","Reset to defaults^4",itemdisable);
X}
X
Xenter_speech()
X{
X showwindow(mydialogptr);
X drawdialog(mydialogptr);
X chat("Go ahead, bash the keebord",voicemode,voicepitch,voicerate,NORMAL_CALL);
X do
X {
X modaldialog(NULL,&myitemhit);
X if (myitemhit == SAYITEM)
X {
X getditem(mydialogptr,SAYTEXTITEM,&itemtype,&itemhandle,&disprect);
X getitext(itemhandle,&speechstr);
X chat(speechstr,voicemode,voicepitch,voicerate,NORMAL_CALL);
X }
X } while (myitemhit != CANCELITEM);
X hidewindow(mydialogptr);
X}
X
X
Xtell_about_me()
X{
X int itemhit;
X
X showwindow(aboutdialogptr);
X drawdialog(aboutdialogptr);
X chat("Hello, I am Simple Speech, a sample speech program written in Cee using Apples Mackin Talk speech driver",voicemode,voicepitch,voicerate,NORMAL_CALL);
X chat("written by Jayson Haines, copy rite 9teen atee6.",voicemode,voicepitch,voicerate,NORMAL_CALL);
X chat("For more info, just hit the button.",voicemode,voicepitch,voicerate,NORMAL_CALL);
X do
X {
X modaldialog(NULL,&itemhit);
X } while ((itemhit != OKITEM) && (itemhit != MOREITEM));
X hidewindow(aboutdialogptr);
X if (itemhit == MOREITEM)
X {
X showwindow(about2dialogptr);
X drawdialog(about2dialogptr);
X chat("I am a giftware program, so you do not need to pay enee money to enn joy mee.",voicemode,voicepitch,voicerate,NORMAL_CALL);
X chat("If u like mee, keep mee. But, do not sell me..",voicemode,voicepitch,voicerate,NORMAL_CALL);
X do
X {
X modaldialog(NULL,&itemhit);
X } while (itemhit != OKITEM2);
X hidewindow(about2dialogptr);
X }
X showwindow(about3dialogptr);
X drawdialog(about3dialogptr);
X do
X {
X modaldialog(NULL,&itemhit);
X } while (itemhit != OKITEM3);
X hidewindow(about3dialogptr);
X}
X
X
Xspeak_file()
X{
X char messagestr[256];
X
X if (!(err = getfile("TEXT",infilename)))
X return(0);
X if ((input_file = fopen (infilename, "r")) == NULL)
X {
X alert(1998,NULL);
X return(0);
X }
X /* SYNTAX: chat(string,mode,pitch,rateint,chatstat) */
X while ( (c = getc(input_file)) != EOF )
X {
X if (c=='\n')
X {
X str[i] = '\0';
X if (i>0)
X chat(str,voicemode,voicepitch,voicerate,NORMAL_CALL);
X i = 0;
X }
X else
X str[i++] = c;
X }
X}
X
Xmenusetup()
X{
X menu (applestring,"About SimpleSpeech^1\311",tell_about_me);
X menu (applestring,"About SimpleSpeech^1\311",itemenable);
X menu("File","Open Speech File/O^2",speak_file);
X menu("File","Open Speech File/O^2",itemenable);
X menu("File","Transfer\311^7",exit_to_other);
X menu("File","(-",nop);
X menu("File","Quit/Q",exit_to_shell);
X menu("Edit","Undo",nop);
X menu("Edit","Undo",itemdisable);
X menu("Edit","Copy/C",nop);
X menu("Edit","Copy/C",itemdisable);
X menu("Edit","Cut/X",nop);
X menu("Edit","Cut/X",itemdisable);
X menu("Edit","Paste/V",nop);
X menu("Edit","Paste/V",itemdisable);
X menu("Edit","Clear",nop);
X menu("Edit","Clear",itemdisable);
X menu("Speech","Enter some words of wisdom^3",enter_speech);
X menu("Speech","Enter some words of wisdom^3",itemenable);
X menu("Speech","Set Pitch",set_pitch);
X menu("Speech","Set Pitch",itemenable);
X menu("Speech","Set Rate",set_rate);
X menu("Speech","Set Rate",itemenable);
X menu("Speech","Reset to defaults^4",reset_settings);
X menu("Speech","Reset to defaults^4",itemdisable);
X menu("Speech","Robotic Speech",set_robotic_mode);
X menu("Speech","Robotic Speech",itemuncheck);
X menu("Speech","Natural Speech",set_natural_mode);
X menu("Speech","Natural Speech",itemcheck);
X}
X
Xwindowsetup()
X{
X}
X
X
Xmain()
X{
X simpletools("About SimpleSpeech^1\311");
X menusetup();
X windowsetup();
X voicepitch = DEFPITCH;
X voicerate = DEFRATE;
X voicemode = natural;
X chat("",voicemode,voicepitch,voicerate,FIRST_CALL);
X mydialogptr = getnewdialog(21200,NULL,(windowptr) -1);
X aboutdialogptr = getnewdialog(21201,NULL,(windowptr) -1);
X about2dialogptr = getnewdialog(21202,NULL,(windowptr) -1);
X about3dialogptr = getnewdialog(18165,NULL,(windowptr) -1);
X ratedialogptr = getnewdialog(2300,NULL,(windowptr) -1);
X pitchdialogptr = getnewdialog(23620,NULL,(windowptr) -1);
X for (;;) simpleevents();
X}
________This_Is_The_END________
if test `wc -l < simplespeech.c` -ne 350; then
echo 'shar: simplespeech.c was damaged during transit'
echo ' (should have been 350 bytes)'
fi
fi ; : end of overwriting check
echo 'Extracting speech.h'
if test -f speech.h; then echo 'shar: will not overwrite speech.h'; else
sed 's/^X//' << '________This_Is_The_END________' > speech.h
X#define noexcpsfile '' /*signals Reader to use only basic rules*/
X#define noreader 'noReader' /*signals SpeechOn to NOT bring in Reader*/
X#define fullunitt -4000 /*error code for driver unit table full*/
X
Xtypedef int speecherr;
Xtypedef short speechrecord[100]; /*of byte {Driver parm block, used internally*/
Xtypedef speechrecord *speechpointer; /*pointer to driver parm block*/
Xtypedef speechpointer *speechhandle; /*handle to driver parm block*/
X
Xtypedef short sex;
X#define male 0
X#define female 1
X
Xtypedef short f0mode;
X#define natural 0
X#define robotic 1
X#define nochange 2
X
Xtypedef short language;
X#define english 0
X#define french 1
X#define spanish 2
X#define german 3
X#define italian 4
X
Xtypedef struct {
X sex thesex;
X language thelanguage;
X int therate;
X int thepitch;
X f0mode themode;
X char thename[256];
X long refcon;
X } voicerecord;
Xtypedef voicerecord *voiceptr;
X
________This_Is_The_END________
if test `wc -l < speech.h` -ne 36; then
echo 'shar: speech.h was damaged during transit'
echo ' (should have been 36 bytes)'
fi
fi ; : end of overwriting check
echo 'Extracting chat.c'
if test -f chat.c; then echo 'shar: will not overwrite chat.c'; else
sed 's/^X//' << '________This_Is_The_END________' > chat.c
X/*
X Speech utility - useful for a verbose about... box.
X Must have the Macintalk driver on the boot disk for this to run.
X*/
X
X#include <speech.h>
X#include <mem.h>
X#include <chat.h>
X
X#define BUFFSIZE 4000L /* arbitrary */
Xextern speechhandle thespeech;
X
X
Xint chat(string,mode,pitch,rate,chatstat)
Xchar string[];
Xint mode;
Xint pitch;
Xint rate;
Xint chatstat;
X{
X handle output;
X short i;
X long strlength;
X speecherr sperr;
X
X if (chatstat == FIRST_CALL)
X {
X sperr = speechon("",&thespeech);
X }
X strlength = (long) strlen(string);
X speechpitch(thespeech,pitch,mode);
X speechrate(thespeech,rate);
X output = (handle)newhandle(0L);
X sperr = reader(thespeech,string,strlength,output);
X if (strlength < 1)
X return(0);
X sperr = macintalk(thespeech,output);
X disposhandle(output);
X if (chatstat == LAST_CALL)
X {
X sperr = speechoff(thespeech);
X }
X}
X
________This_Is_The_END________
if test `wc -l < chat.c` -ne 44; then
echo 'shar: chat.c was damaged during transit'
echo ' (should have been 44 bytes)'
fi
fi ; : end of overwriting check
echo 'Extracting chat.h'
if test -f chat.h; then echo 'shar: will not overwrite chat.h'; else
sed 's/^X//' << '________This_Is_The_END________' > chat.h