* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Program  *  MVDEMO.PRG                                                    *
* System   *  Micro/Voice for Clipper Summer '87                            *
* Version  *  Version 1.00                                                  *
* Library  *  MVCLIP87.LIB - 06/10/90 1:00a                                 *
* Author   *  Steve Badaracco                                               *
* Notice   *  (c)1990, DataBlaze Solutions, All Rights Reserved             *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*                                                                           *
* This program demonstrates some of the functionality of Micro/Voice.       *
*                                                                           *
* To compile (requires The Clipper Compiler, Summer '87 Version):           *
*     CLIPPER MVDEMO                                                        *
*                                                                           *
* To link for execution (using Microsoft Overlay Linker Version 3.x):       *
*     LINK MVDEMO,,NUL,CLIPPER+EXTEND+MVCLIP87/SE:256                       *
* To link for execution (using Turbo Link Version 1.x):                     *
*     TLINK MVDEMO,,NUL,CLIPPER+EXTEND+MVCLIP87                             *
* To link for execution (using PLINK86plus Version 2.24 for Clipper):       *
*     PLINK86 FI MVDEMO LIB CLIPPER,MVCLIP87,EXTEND                         *
* To link for execution (using Blinker Dynamic Overlay Linker Version 1.x): *
*     BLINKER FI MVDEMO LIB CLIPPER,MVCLIP87,EXTEND                         *
*                                                                           *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

* Exit READ with F2
set function 2 to ""

* Initialize Micro/Voice (these settings are for PS/2 Model 60):
if v_init( "system01.dct", "mycustom.dct", 1, 19, 2 ) # 0
   ? 'Voice initialization error: data file(s) not found.'
   ?
   quit
endif

first = .t.

* Initialize GET variables
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 ONE"

* Main demo loop
do while .t.

   clear screen

   * Retain any previous values 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  ***  Processing Demonstration Program    "
   set color to

   if first
      first = .f.
      v_speak( "w-eh-l-c-uh-m t-oo tz-uh m-i-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
   v_setdelay(del)
   v_setres(res)
   v_setspace(spc)
   v_setsound(snd)

   * Process ONE of the strings entered (check GETs top-down)
   if ! empty( phstring )
      * A phoneme string
      thestring = trim( phstring )
   elseif ! empty( acstring )
      * An acronym
      thestring = v_unpack( v_apack( acstring ) )
   elseif ! empty( wostring )
      * A string of text
      thestring = v_unpack( v_wpack( wostring ) )
   else
      * Nothing entered
      loop
   endif

   * Display phoneme string equivalent
   @ 12,0
   ? 'Phoneme string:'
   ? upper( thestring )

   * Say it (if sound is on)
   v_speak( thestring )

   ?
   wait

enddo

* Display final banner and exit
set color to n/w
@ 24, 0 say "     Micro/Voice for Clipper Summer '87  ***  End of Demonstration Program      "
set color to
for x = 1 to 24
   ?
next

@ 3, 0
v_setdelay( v_setdelay() - 4 )
v_speak( "b-ah-ee" )
v_setdelay( v_setdelay() + 4 )
v_speak( "b-ah-ee" )

quit


*=============================================================================
procedure help
parameters a, b, c

private winbuff, mvar, message, script, mrow, mcol

mrow = row()
mcol = col()
winbuff = savescreen( 1, 0, 7, 40 )
@ 1,  0,  7, 40 box "ÚÄ¿³ÙÄÀ³ "
@ 7, 10 say "  <Any Key> to return  "

mvar    = readvar()

do case

   case readvar() = "PHSTRING"
      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 readvar() = "ACSTRING"
      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 readvar() = "WOSTRING"
      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 readvar() = "DEL"
      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 readvar() = "RES"
      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 readvar() = "SPC"
      message = "    Space between words: 1..10."
      script  = "eh-n-t-uh-r tz-uh s-p-a-s b-ee-t-w-ee-n w-uh-r-d-z"

   case readvar() = "SND"
      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
      message = "       No help available here."
      script  = "n-oh h-eh-l-p uh-v-a-l-uh-b-l h-ee-r"

endcase

@ 4, 3 say message
v_speak( script )

inkey(0)
restscreen( 1, 0, 7, 40, winbuff )
@ mrow, mcol say ""

return
