* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Program * MVDEMO.PRG * * System * Micro/Voice for Clipper Summer '87 and 5.0 * * Version * Version 2.00 * * Library * MVCLIP87.LIB/MVCLIP50.LIB - 11/01/90 2:00a * * Author * Steve Badaracco * * Notice * (c)1990, DataBlaze Solutions, All Rights Reserved * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * --- NOTE --- * * As explained in the DOC, the pitch (speed-delay) is important to the * * clarity and understandability of the speech you will hear. In the call * * to v_init() below, you will notice a speed-delay of 23, which is about * * right for an IBM PS/2 Model 50Z or 55SX. Unless you are running this * * program on one of these two machines, you will need to adjust the * * speed-delay to suit the hardware. Remember, a HIGHER number LOWERS the * * pitch, to compensate for a FASTER machine. * * * * Since this is a full-featured demo, the speed-delay of 23 will be used * * only as an initial setting, and may be adjusted on the demo screen. * * * * Syntax: MVDEMO * * This program demonstrates some of the functionality of Micro/Voice. * * * * To compile (requires The Clipper Compiler, Summer '87 or 5.0 Version): * * CLIPPER MVDEMO * * * * To link using Microsoft Overlay Linker Version 3.x (Summer '87 syntax): * * LINK MVDEMO,,NUL,CLIPPER+EXTEND+MVCLIP87/SE:256 * * To link using Turbo Link Version 1.x (Summer '87 ONLY): * * TLINK MVDEMO,,NUL,CLIPPER+EXTEND+MVCLIP87 * * To link using PLINK86plus Version 2.24 (Summer '87 ONLY): * * PLINK86 FI MVDEMO LIB CLIPPER,MVCLIP87,EXTEND * * To link using Blinker Dynamic Overlay Linker (Summer '87 syntax): * * BLINKER FI MVDEMO LIB CLIPPER,MVCLIP87,EXTEND * * * * To link using .RTLink Version 3.1x (Clipper 5.0 ONLY): * * RTLINK FI MVDEMO LIB MVCLIP50 (assumes LIB= in DOS environment) * * To link using Microsoft Overlay Linker Version 3.x (Clipper 5.0 syntax): * * LINK MVDEMO,,NUL,MVCLIP50/SE:256 (assumes LIB= in DOS environment) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Exit READ with F2 (like Ctrl+W) ********************************* set function 2 to chr(23) * Initialize Micro/Voice (these settings are for PS/2 Model 55SX): ****************************************************************** init = v_init( "system01.dct", "mycustom.dct", 1, 23, 2 ) if init # 0 ? 'Unable to load voice system: error code = ' + ltrim(str(init)) + '.' ? quit endif first = .t. * Initialize GET buffers ************************ phstring = "" && for a string of phonemes, e.g. "T-EH-S-T W-UH-N" acstring = "" && for an acronym string, e.g. "IBM" (or "I.B.M.") wostring = "" && for a normal text string, e.g. "TEST NUMBER ONE" * Main processing loop ********************** do while .t. clear screen * Retain values from previous loop, for editing *********************************************** phstring = pad( phstring, 60 ) acstring = pad( acstring, 60 ) wostring = pad( wostring, 60 ) * Get Micro/Voice current settings ********************************** del = v_setdelay() res = v_setres() spc = v_setspace() snd = v_setsound() * Display data entry labels and GETs ************************************ @ 1, 0 say "Phoneme String:" get phstring @ 2, 0 say "..or.. Acronym:" get acstring @ 3, 0 say "..or.. Word:" get wostring @ 5, 0 say " SpeedDelay:" get del @ 6, 0 say " Resolution:" get res @ 7, 0 say " Blank Space:" get spc @ 8, 0 say " Sound On:" get snd picture "Y" @ 10, 0 say "F1 = Talking Help F2 = Accept Screen Esc = Quit" * Display footer on the screen ****************************** set color to n/w @ 24, 0 say " Micro/Voice for Clipper Summer'87 & 5.0 *** Processing Demonstration Program " set color to * If we just started up, give the user a warm welcome ***************************************************** if first first = .f. v_speak( "w-eh-l-k-u-m t-oo tz-uh m-uh-ee-k-r-oh v-oh-ee-s d-eh-m-oh" ) endif read * Check for Esc key ******************* if lastkey() = 27 exit endif * Update Micro/Voice settings with new choices from GETs ******************************************************** v_setdelay(del) v_setres(res) v_setspace(spc) v_setsound(snd) * Process ONE of the strings entered (check GETs from top-down) *************************************************************** if ! empty( phstring ) * A phoneme string in first GET ******************************* thestring = trim( phstring ) elseif ! empty( acstring ) * An acronym in second GET ************************** thestring = v_unpack( v_apack( acstring ) ) elseif ! empty( wostring ) * A string of text in third GET ******************************* thestring = v_unpack( v_wpack( wostring ) ) else * Nothing entered ***************** loop endif * Display phoneme string equivalent on the screen ************************************************* @ 12,0 ? 'Phoneme string:' ? upper( thestring ) * Say it (if sound is on)! ************************** v_speak( thestring ) ? wait enddo * Display final banner and exit to DOS ************************************** set color to n/w @ 24, 0 say " Micro/Voice for Clipper Summer'87 & 5.0 ** End of Demonstration Program " set color to * Scroll the banner to top of screen ************************************ for x = 1 to 24 ? next @ 3, 0 * Say "Bye bye" *************** v_setdelay( v_setdelay() - 4 ) v_speak( "b-ah-ee" ) v_setdelay( v_setdelay() + 4 ) v_speak( "b-ah-ee" ) quit * EOF: MVDEMO.PRG *** * Here is a sample implementation of talking help. * In a real-time system, the phoneme strings would not be hard-coded, but * stored in a text file or database memo field for retrieval at run time. * Better yet, they could be prepackaged strings processed by v_pack() and * stored in character fields (cannot be memo fields because the strings * can contain embedded chr(0)'s). ************************************************************************* procedure help parameters theproc, theline, thevar private winbuff, message, script, mrow, mcol * Save cursor location and screen memory **************************************** mrow = row() mcol = col() winbuff = savescreen( 1, 0, 7, 40 ) * Draw the window ***************** @ 1, 0, 7, 40 box "ÚÄ¿³ÙÄÀ³ " @ 7, 10 say " to return " do case case thevar = "PHSTRING" && GETting a phoneme string message = "Enter phoneme string (e.g. k-ae-t)." script = "eh-n-t-uh-r uh f-oh-n-ee-m s-t-r-i-n-g" case thevar = "ACSTRING" && GETting an acronym string message = "Enter acronym string (e.g. C.A.T)." script = "eh-n-t-uh-r uh-n ae-k-r-uh-n-ih-m s-t-r-i-n-g" case thevar = "WOSTRING" && GETting a text string message = " Enter a text string (e.g. cat)." script = "eh-n-t-uh-r uh t-eh-k-s-t s-t-r-i-n-g" case thevar = "DEL" && GETting speed delay message = " Speed/delay factor: range 1..100." script = "eh-n-t-uh-r tz-uh s-p-ee-d-d-ee-l-a-ee f-ae-k-t-uh-r" case thevar = "RES" && GETting resolution message = " Resolution factor: 1,2,4,6,or 8." script = "eh-n-t-uh-r tz-uh r-eh-z-uh-l-oo-sh-uh-n f-ae-k-t-uh-r" case thevar = "SPC" && GETting space between words message = " Space between words: 1..10." script = "eh-n-t-uh-r tz-uh s-p-a-ee-s b-ee-t-w-ee-n w-uh-r-d-z" case thevar = "SND" && GETting sound (Y/N) message = " Sound status: Y=ON / N=OFF." script = "eh-n-t-uh-r eh-n t-oo t-uh-r-n s-ae-oo-n-d aw-f" otherwise && Anything else message = " No help available here." script = "n-oh h-eh-l-p uh-v-a-l-uh-b-l h-ee-r" endcase * Display visual help and spoken help ************************************* @ 4, 3 say message v_speak( script ) * Wait for key, restore screen and cursor ***************************************** inkey(0) restscreen( 1, 0, 7, 40, winbuff ) @ mrow, mcol say "" return