Announcement

Collapse
No announcement yet.

Com & Sapi

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • John Thompson
    replied
    Theo, there are, but they are related to the text to speech section of SAPI, not the speech recognition. I installed the SAPI SDK after which time the code above worked, but I had previously ran my PB 8 samples on computers I was most positive did not have the SAPI SDK installed on them.

    Thanks!

    -John

    Leave a comment:


  • Theo Gottwald
    replied
    Aren't there such samples in the SAMPLES directory, supplied with PB 9?
    They are really worth to look at!

    Leave a comment:


  • José Roca
    replied
    It works in my computer. If you have several versions of SAPI installed, that I don't know, maybe it is trying to use a version that has not ISpeechRecoContext implemented. Try using the version dependent ProgIDs, e.g. "SAPI.SpObjectToken.1" and "SAPI.SpInProcRecoContext.1".

    Leave a comment:


  • John Thompson
    started a topic Com & Sapi

    Com & Sapi

    Windows XP Home SP3
    PowerBASIC Win 9

    I used the PB COM Browser to generate an INClude file for SAPI (Microsoft Speech). When I created a small program and attemptd to compile it, it gave numerous errors in reference to undefined TYPEs. It turns out that an item within a TYPE would be TYPE (defined later in the INC). I copied and pasted these above the original TYPE and it solved that problem.

    With that solved, I tried to work on the speech recognition (which I've got working in PB8), but I'm having problems with ISpeechRecoContext. It turns out that oRecoContext never obtains a value and always errors out. I tried messing around with it for an hour or two and then tried some of the other interfaces and found out they worked as expected. Can anyone advise what may be causing this? PB8 works as expected. PB9 accesses SAPI's other keywords as expected. I'm stuck.

    SAPI.INC (header of SAPI.INC [created via PB COM Browser])
    Code:
    ' Library Name: SpeechLib
    ' Library File: C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll
    ' Description : Microsoft Speech Object Library
    ' GUID : {C866CA3A-32F7-11D2-9602-00C04F8EE628}
    ' LCID : 0
    ' Version : 5.0
    SAPI.BAS
    Code:
    #COMPILE EXE
    #DIM ALL
    
    #INCLUDE "Win32API.INC"
    #INCLUDE "SAPI.INC"
    
    FUNCTION PBMAIN () AS LONG
    
        DIM oObjectToken    AS ISpeechObjectToken
        DIM oRecoContext    AS ISpeechRecoContext
    
        'Added later for testing.
        oObjectToken = NEWCOM $PROGID_SpObjectToken
        IF ISFALSE ( ISOBJECT ( oObjectToken ) ) THEN MSGBOX "oObjectToken ERROR" : EXIT FUNCTION
    
        'Original Interest    
        oRecoContext = NEWCOM $PROGID_SpSharedRecoContext
        IF ISFALSE ( ISOBJECT ( oRecoContext ) ) THEN MSGBOX "oRecoContext ERROR" : EXIT FUNCTION
    
    END FUNCTION
Working...
X