Page 4 of 4

Posted: Thu Jul 19, 2007 8:32 pm
by dobro
@Esteban1!
tu vois, heureusement que sur le forum français, les gens sont plus partageur que toi !!
Nico a trouvé comment faire marcher SAPI5 sans librairie !! :D
ce serai sympathique de ta part de nous éviter de chercher le SAPI4
et de donner enfin le code de ta librairie non ?

voici le code a Nico :D


Google translate:
*************************************************************
@Esteban1!
you see, fortunately that on the French forum, people are a more partagor than you!!
Nico found how to make work SAPI5 without lib !! : D
it will be sympathetic nerve of your share to avoid us seeking the SAPI4 and to not give finally the code of your Lib "pureTTS"?
here the code has Nico: D


Code: Select all

; Une partie du code à été écrit par Sapero avec le language Aurora Compiler
; Traduit en Purebasic By Nico

#CLSCTX_INPROC_SERVER=1

;/Valeur pour SpeechVoiceSpeakFlags
#SVSFDefault = 0
#SVSFlagsAsync = 1
#SVSFPurgeBeforeSpeak = 2
#SVSFIsFilename = 4
#SVSFIsXML = 8
#SVSFIsNotXML = 16
#SVSFPersistXML = 32
#SVSFNLPSpeakPunc = 64
#SVSFNLPMask = 64
#SVSFVoiceMask = 127
#SVSFUnusedFlags = -128

Interface ISpeechObjectToken Extends IDispatch
    get_Id( ObjectId)
    get_DataKey( ISpeechDataKey.l)
    get_Category( ISpeechObjectTokenCategory.l)
    GetDescription( Locale.l,Description)
    SetId( id,CategoryID,CreateIfNotExist)
    GetAttribute( AttributeName,*AttributeValue)
    CreateInstance( pUnkOuter,SpeechTokenContext,Object)
    Remove( ObjectStorageCLSID)
    GetStorageFileName( ObjectStorageCLSID,KeyName,FileName,SpeechTokenShellFolder,*FilePath)
    RemoveStorageFileName( ObjectStorageCLSID,KeyName,DeleteFile)
    IsUISupported( TypeOfUI,*ExtraData,*Object,*Supported)
    DisplayUI( hwnd,Title,TypeOfUI,*ExtraData,*Object )
    MatchesAttributes( Attributes,*Matches)
EndInterface

Interface ISpeechObjectTokens Extends IDispatch
    get_Count(a.l)
    Item(index.l,Token.ISpeechObjectToken)
    get__NewEnum(ppEnumVARIANT.IUnknown )
EndInterface

Interface ISpeechVoice Extends IDispatch
    get_Status(*ISpeechVoiceStatus .l)
    get_Voice(*ISpeechObjectToken)
    put_Voice(*ISpeechObjectToken.l)
    get_AudioOutput(*ISpeechObjectToken.l)
    put_AudioOutput(*ISpeechObjectToken.l)
    get_AudioOutputStream(*ISpeechBaseStream.l)
    put_AudioOutputStream(*ISpeechBaseStream.l)
    get_Rate(long.l)
    put_Rate(long.l)
    get_Volume(long.l)
    put_Volume(long.l)
    put_AllowAudioOutputFormatChangesOnNextSet(VARIANT_BOOL.l)
    get_AllowAudioOutputFormatChangesOnNextSet(VARIANT_BOOL.l)
    get_EventInterests(SpeechVoiceEvents .l)
    put_EventInterests(SpeechVoiceEvents .l)
    put_Priority(SpeechVoicePriority.l)
    get_Priority(SpeechVoicePriority.l)
    put_AlertBoundary(SpeechVoiceEvents.l)
    get_AlertBoundary(SpeechVoiceEvents.l)
    put_SynchronousSpeakTimeout(long.l)
    SynchronousSpeakTimeout(long.l)
    Speak(*Text, SpeechVoiceSpeakFlags.l, long.l)
    SpeakStream(*ISpeechBaseStream, SpeechVoiceSpeakFlags.l, long.l)
    Pause()
    Resume()
    Skip(*Type, NumItems.l, long.l)
    GetVoices(*RequiredAttributes.l, *OptionalAttributes, *ISpeechObjectTokens.l)
    GetAudioOutputs(*RequiredAttributes, *OptionalAttributes, *ISpeechObjectTokens.l)
    WaitUntilDone(msTimeout.l, VARIANT_BOOL.l)
    SpeakCompleteEvent(long.l)
    IsUISupported(*TypeOfUI, *ExtraData.VARIANT, VARIANT_BOOL.l)
    DisplayUI(hWndParent.l, *Title, *TypeOfUI, *ExtraData.VARIANT)
    
EndInterface

Texte1.s="SAPI.SpVoice"
*Tampon1=AllocateMemory((Len(Texte1)+1)*2)
PokeS(*Tampon1,Texte1,-1,#PB_Unicode)

Texte2.s="{269316D8-57BD-11D2-9EEE-00C04F797396}"
*Tampon2=AllocateMemory((Len(Texte2)+1)*2)
PokeS(*Tampon2,Texte2,-1,#PB_Unicode)
 
If CLSIDFromProgID_(*Tampon1, @clsid.CLSID)=#S_OK 
    If CLSIDFromString_(*Tampon2, @Refiid.CLSID)=#S_OK 
        CoInitialize_(0) 
        If  CoCreateInstance_(clsid, #Null, #CLSCTX_INPROC_SERVER, Refiid, @SpeechVoice.ISpeechVoice)=#S_OK       
            
            SpeechVoice\GetVoices(0, 0, @SpeechObjectTokens.ISpeechObjectTokens)
            SpeechObjectTokens\get_Count(@Count) 
            
            
            Texte4.s="Language"
            *Tampon4=AllocateMemory((Len(Texte4)+1)*2)
            PokeS(*Tampon4,Texte4,-1,#PB_Unicode)
            bstrText = SysAllocString_(*Tampon4)
            
            ;Listing des voix installés
            For a= 0 To Count-1
                SpeechObjectTokens\Item(a,@Token.ISpeechObjectToken)
                Token\GetDescription(0,@Description)
                Token\GetAttribute( bstrText,@AttributeValue)
                Debug PeekS(Description,-1,#PB_Unicode)
                
                ; retourne un code sous forme de chaine correpondant au language
                ; Apparemment 40C correspond au français
                Debug PeekS(AttributeValue,-1,#PB_Unicode)
                Token\Release()
            Next
            
            SysFreeString_(bstrText)
            
            
            ; Je choisit la voix 1, commence à 0
            SpeechObjectTokens\Item(0,@Token.ISpeechObjectToken) ; ici le choix de la voix (0)voix zero)!!
            
            SpeechVoice\put_Voice(Token)
            
            SpeechObjectTokens\Release()   
            SpeechVoice\put_Volume(100); reglage volume (0 a 100)
            SpeechVoice\put_Rate(1) ; vitesse de diction (-10 a 10) 
            Texte3.s="PureBasic!  speak very well" 
            
            *Tampon3=AllocateMemory((Len(Texte3)+1)*2)
            PokeS(*Tampon3,Texte3,-1,#PB_Unicode)
            
            temp=#SVSFDefault
            bstrText = SysAllocString_(*Tampon3)
            SpeechVoice\Speak(bstrText, 0, @temp)
            SysFreeString_(bstrText)
            
            FreeMemory(*Tampon3)
            
            SpeechVoice\Release()
        EndIf
        
        CoUninitialize_()
    EndIf
EndIf
FreeMemory(*Tampon1)
FreeMemory(*Tampon2)
End

Posted: Thu Jul 19, 2007 11:51 pm
by minirop
dobro wrote:it will be sympathetic nerve of your share to avoid us seeking the SAPI4 and to not give finally the code of your Lib "pureTTS"?
here the code has Nico: D
it will be greatfull is you can avoid us to search for SAPI4 by giving us the source of your lib

TTSInit and callbacks, only position works for me.Any idea?

Posted: Mon Jul 30, 2007 8:55 pm
by vrman3d
Hi guys,

Estaban1, first off, just like everyone else I wanted to say GREAT JOB! I love your little TTS library and have been using it for all sorts of stuff.

BUT, for some reason I am never able to get 2 of the callbacks to work for SpeechStarted and SpeechEnded in the TTSInit function. The SpeechPosition type callback works fine. Everything else seems to work great, but those two don't seem to work for me. I can put a MessageRequester in the callback, it's never displayed. I can put breakpoints in there and they are never triggered.

Also I noticed that other peoples' demos made with TTS don't activate those procedures on my system either. Like the ones that are supposed to display "Speaking..." in the status bar, they never do as well.

So is it perhaps something to do with my SAPI installation? I really have no idea and I'm really hoping you can help. I've made work arounds using the @positionEvent callback but still it would be very handy to have the start and stop events working.

Thanks for any help, much appreciated!

Nevermind I think...

Posted: Tue Jul 31, 2007 12:07 am
by vrman3d
Nevermind my last posting I think. I noticed now that it seems like only certain selected voices have this problem, so perhaps only SAPI 5 voices expose this capability. I only have 1 SAPI5 voice (sam) and the rest are SAPI4's, and since MS Sam is so terrible I never use it hence me thinking this problem was on everything.

Thanks again for a very well written, useful and fun library Estaban.

Best regards,
-=VRMan=-

Posted: Wed Oct 01, 2008 4:05 pm
by ebs
Esteban1,

I just went back to a working program I wrote using your TTS library. With PB 4.20, I get this error:

Linker error
POLINK: error: Unresolved external symbol '_PB_Mid'.
POLINK: fatal error: 1 unresolved external(s).

Is there any chance you will be updating this library for PB 4.20 or 4.30?

Regards,
Eric

SAPI5 problems

Posted: Fri Jan 23, 2009 7:16 am
by John-G
I have tryed this little bit of code and it works so good... thanks thanks thanks

But i seem to have a little problem .. I can not use
after talking then doing a "If InitSound() = 0" it will not make any sounds .. i can load any sounds at all but if i load the sound first then no voice's anyone know why or can add a little help thanks



[quote="dobro"]@Esteban1!
tu vois, heureusement que sur le forum français, les gens sont plus partageur que toi !!
Nico a trouvé comment faire marcher SAPI5 sans librairie !! :D
ce serai sympathique de ta part de nous éviter de chercher le SAPI4
et de donner enfin le code de ta librairie non ?

voici le code a Nico :D


Google translate:
*************************************************************
@Esteban1!
you see, fortunately that on the French forum, people are a more partagor than you!!
Nico found how to make work SAPI5 without lib !! : D
it will be sympathetic nerve of your share to avoid us seeking the SAPI4 and to not give finally the code of your Lib "pureTTS"?
here the code has Nico: D


Code: Select all

; Une partie du code à été écrit par Sapero avec le language Aurora Compiler
; Traduit en Purebasic By Nico

#CLSCTX_INPROC_SERVER=1

Posted: Tue Apr 28, 2009 3:52 pm
by T-Light
Has there been an update for this lib to pb 4.3?

Unfortunately, the old lib won't compile anymore due to...
"The following PureLibrary is missing: StringExtension."
Don't know a way around this other than removing the lib altogether, which would be a huge shame.

Posted: Tue Apr 28, 2009 4:38 pm
by bobobo

Posted: Tue Apr 28, 2009 4:58 pm
by T-Light
Thanks.

I'll take a look :D