home *** CD-ROM | disk | FTP | other *** search
AmigaBASIC Source Code | 1988-09-06 | 2.0 KB | 98 lines |
- REM --- Speech Demo Program
- GOSUB InitSpeech
- LOCATE 1,1
- PRINT "Use Mouse to change control settings."
- PRINT "Please type what you want me to say, followed by the Return"
- PRINT "key, or just press Return to repeat the last message."
- COLOR 0,1
- WHILE 1
- LOCATE 4,1
- PRINT ">";SPACE$(80)
- LOCATE 4,3
- k$=""
- msg$=""
- REM -- This loop builds msg$, we don't just do a LINE INPUT is to
- REM -- allow Mouse Interrupts
- WHILE k$<>CHR$(13)
- k$=INKEY$
- IF k$<>"" THEN
- IF k$=CHR$(8) THEN 'backspace
- LenMSG=LEN(msg$)
- IF LenMSG>0 THEN
- msg$=LEFT$(msg$,LenMSG-1)
- PRINT k$;
- END IF
- ELSE
- msg$=msg$+k$
- PRINT k$;
- END IF
- END IF
- WEND
- IF msg$=CHR$(13) THEN
- msg$=lastMsg$
- LOCATE 4,3
- PRINT msg$
- END IF
- lastMsg$=msg$
- SAY TRANSLATE$(msg$),current%
- WEND
-
- DrawControls:
- FOR i=0 TO 5
- LOCATE 2*i+6,1
- PRINT " ";nam$(i);
- WHILE POS(0)<18: PRINT ".";: WEND
- x1(i)=WINDOW(4)+10
- y1(i)=WINDOW(5)-8
- x2(i)=WINDOW(4)+100
- y2(i)=WINDOW(5)
- GOSUB DrawControl
- NEXT i
- RETURN
-
- REM --- Draw's control box for control
- DrawControl:
- LINE (x1(i),y1(i))-(x2(i),y2(i)),3,bf
- x=(current%(i)-min(i))/(max(i)-min(i))
- x=x1(i)+x*(x2(i)-x1(i))
- LINE (x-2,y1(i))-(x+2,y2(i)),2,bf
- RETURN
-
- HandleMouse:
- WHILE MOUSE(0)<>0
- mouseX=MOUSE(1)
- mouseY=MOUSE(2)
- FOR i=0 TO 5
- IF mouseX>x1(i) AND mouseX<x2(i) THEN
- IF mouseY>y1(i) AND mouseY<y2(i) THEN
- v=(mouseX-x1(i))/(x2(i)-x1(i))
- current%(i)=min(i)+v*(max(i)-min(i))
- GOSUB DrawControl
- END IF
- END IF
- NEXT i
- WEND
- RETURN
-
- InitSpeech:
- FOR i=0 TO 5
- READ nam$(i),min(i),max(i),current%(i)
- NEXT i
- SAY TRANSLATE$("Please"),current%
- GOSUB DrawControls
- ON MOUSE GOSUB HandleMouse
- MOUSE ON
- SAY TRANSLATE$("type what you want me to say"),current%
- RETURN
-
- DATA "Pitch",65,320,105
- DATA "Inflection",0,1,0
- DATA "Rate",40,400,144
- DATA "Voice",0,1,0
- DATA "Tune",5000,28000,20590
- DATA "Volume",0,64,63
-
-
-
-
-