Re: [fpc-pascal] Microsoft SAPI on Freepascal
I changed to Compiler Version 3.3.1-12875-gadf843196a which is what FPCUPDeluxe installed when I installed Trunk and now it runs just fine. So I guess there was a bug in 3.3.1-10077-gc8403ad49e that was fixed already. I was so convinced that I was doing something wrong I didn't even think to try another version. >Because I use a screen reader, I have multiple sapi voices installed, (though I rarely use them), but I haven't played with the code enough just yet to see why it fails when it tries to select one, when not selecting one works just fine Here's a sample program that now works on the updated 3.3.1, I guess it should work on 3.2 as well. It lists all available voices and lets you choose one. Maybe that would let you select another voice? {$Mode OBJFPC} program VoiceSelection; uses ComObj; var v: OleVariant; selectedVoiceIndex: Integer; voiceName: string; speechText: string; begin v := CreateOleObject('SAPI.SpVoice'); Writeln('Available Voices:'); for selectedVoiceIndex := 0 to v.GetVoices.Count - 1 do begin voiceName := v.GetVoices.Item(selectedVoiceIndex).GetDescription; Writeln('Voice ', selectedVoiceIndex + 1, ': ', voiceName); end; Writeln; Writeln('Enter the index of the voice you want to use:'); Readln(selectedVoiceIndex); if (selectedVoiceIndex < 1) or (selectedVoiceIndex > v.GetVoices.Count) then begin Writeln('Invalid voice index.'); Exit; end; voiceName := v.GetVoices.Item(selectedVoiceIndex - 1).GetDescription; v.Voice := v.GetVoices.Item(selectedVoiceIndex - 1); Writeln('Selected Voice: ', voiceName); speechText := 'Hello World, this is ' + voiceName; Writeln('Speech Text: ', speechText); v.Speak(speechText); end. James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SDL2 Event Registration (and case statements)
El Sun, 25 Jun 2023 13:42:00 -0300 Rafael Picanço via fpc-pascal escribió: > Thanks Guilhermo, You welcome. :) > > Just to clarify, I do have a limited number of events. Lets say, 2 > events. So, using the SDL_RegisterEvents function, is it possible to > define these two new events as normal constants so they will be known > at compile time and will make Free Pascal case statements happy? Yes, you can. But be careful that no other events are registered before yours. > > Best, > R Regards, Guillermo Martínez ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Microsoft SAPI on Freepascal
On 26-6-2023 21:39, Michael Van Canneyt via fpc-pascal wrote: (afaik 3.2.2's comobj does this automatically, in older version YMMV). Well, I checked prior to sending my answer. If it does this, it's well hidden. There seems to be some hook for it, though. It hooks initproc into a linked list fashion which is called at the end of FPC_INITIALIZEUNITS, which is a way to put it last/late in the init sequence. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Microsoft SAPI on Freepascal
On Mon, 26 Jun 2023, Steve Litt via fpc-pascal wrote: Steve Litt via fpc-pascal said on Mon, 26 Jun 2023 22:26:17 -0400 Where does one get ComObj? On my box this errored out with: I went off half cocked. I'm using Linux. Is ComObj even available on Linux? Would you expect Voice := CreateOLEObject('SAPI.SpVoice') and Voice.Speak('I am speaking.', 0) to work on Linux? I know soundon and soundoff don't work with Linux. comobj and everything COM related is windows specific. So this will never work on linux. The technology that comes closest on Linux is DBUS. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal