[futurebasic] FB3 Speech Bug

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Dabs@...
Date: Sat, 23 Oct 1999 14:53:24 EDT
>Can anyone see any problem with this function?  It worked in FB2 but speaks
>garbage in FB3.  You have to establish a speech channnel 'gSpeechChanPrt&'
>before calling.
>
>CLEAR LOCAL
>'__________________________________________________
>LOCAL FN SpeakEditField(EFNum)
>'__________________________________________________
>DIM TeHndl&,NumChar%,textHndl&
>TeHndl& = TEHANDLE(EFNum)
>StartChar% = TeHndl&..teSelStart%
>EndChar% = TeHndl&..teSelEnd%
>NumChar% = TeHndl&..teLength%
>textHndl& = TeHndl&..teTextH&
>hState = FN HGETSTATE(textHndl&)
>OSErr = FN HLOCK(textHndl&)
>LONG IF EndChar% > StartChar%
>   LONG IF gSpeechChanPtr&
>     OSErr = FN
>SpeakText(gSpeechChanPtr&,[textHndl&]+StartChar%,EndChar%-StartChar%)
>   END IF
>END IF
>
>OSErr = FN HSETSTATE(textHndl&,hState)
>END FN = OSErr
>
>
>TIA
>David
>
>David---I haven't really studied your code (since it worked in FB 2) but
>you must be running with the compiler option for dimming local variables
>turned off. I don't know if this is a factor,  but keeping it turned on has
>helped me during some conversions. I don't rely on defaults. For example,
>the call to FN HGETSTATE I **believe** returns a 2 byte value. I would use
>a DIMed hState% instead of hState. Same situation when you get the TE
>handle with EFNum. Probably not the issue.


Thanks.  I tried a hundred ways to get this to work including changing from 
register based variables because the function seems to want a pointer to a 
memory address for the text.  Nothing works.  Even though you can display the 
text and it displays correctly the speech is something like "slash.... 
four... asterik.... greater than" etc.  The speak string function works but 
something is obviously wrong with the "SpeakText" FN in the current version.


David