Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-27 Thread James Richters via fpc-pascal
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

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-27 Thread Marco van de Voort via fpc-pascal
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

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-27 Thread Michael Van Canneyt via fpc-pascal
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 :=

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Steve Litt via fpc-pascal
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.',

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Steve Litt via fpc-pascal
Rik van Kekem via fpc-pascal said on Mon, 26 Jun 2023 16:12:06 +0200 >program Project1; >{$mode objfpc}{$H+} >uses >   Classes, ComObj; >var >   Voice: olevariant; >begin >   Voice := CreateOLEObject('SAPI.SpVoice'); >   Voice.Speak('I am speaking.', 0); >   Voice.Speak('I am also speaking.',

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
Well that's worth a lot, it may be indicating a bug in 3.3.1? I guess I need to get on the current trunk to see if it's still misbehaving. James >Also, for what it's worth, your code works fine on fpc 3.20. ___ fpc-pascal maillist -

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
I was using OleVarient and Varient. How can I check to see if CreateOleObject was successful? James >It sounds like " SpVoice := CreateOleObject('SAPI.SpVoice');" is failing and >then SpVoice is nil ? >May be try with an OleVariant instead of a simple Variant ? (i.e declare var >SpVoice:

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
Also, for what it's worth, your code works fine on fpc 3.20. On 6/26/2023 11:04 PM, James Richters via fpc-pascal wrote: I appreciate the help with this. I'm still confused. In my original post, I already had CoInitialize, CoUninitialize; and Unit ComOBJ, Unit Windows and Unit ActiveX I

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
Hmm, ok, apparently something changed in the way FPC handles objects between 3.31 and 3.20 (the version I'm using). Thought I had 3.22, but . I guess it could be a sapi version difference too, but I don't know how to check that. On 6/26/2023 11:15 PM, James Richters wrote: When I run the

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Jean SUZINEAU via fpc-pascal
It sounds like "SpVoice := CreateOleObject('SAPI.SpVoice');" is failing and then SpVoice is nil ? May be try with an OleVariant instead of a simple Variant ? (i.e declare var SpVoice: OleVariant; ) ___ fpc-pascal maillist -

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
When I run the code below I get: An unhandled exception occurred at $004143C0: ■ Free Pascal IDE Version 1.0.12 [2022/02/07] ■ Compiler Version 3.3.1-10077-gc8403ad49e ■ GDB Version GNU gdb (GDB) 7.2 Running "i:\programming\sapi.exe " EOleError: Variant does not reference an automation object

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
I appreciate the help with this. I'm still confused. In my original post, I already had CoInitialize, CoUninitialize; and Unit ComOBJ, Unit Windows and Unit ActiveX I was still getting EOleError: Variant does not reference an automation object. Do I need to do all this Change FPU stuff?

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
On 6/26/2023 6:26 PM, Michael Van Canneyt via fpc-pascal wrote: On Mon, 26 Jun 2023, James Richters wrote: I tried to make your example into a FPC program without Lazarus: {$mode objfpc}{$H+} uses  comobj; var  SavedCW: Word;  v: OleVariant; begin   v:=CreateOleObject('SAPI.SpVoice');  

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
On 6/26/2023 3:51 PM, Michael Van Canneyt via fpc-pascal wrote: Try changing the selected voice to 0 instead of 1. Yeah, already tried that, didn't help any. *grumble* Because I use a screen reader, I have multiple sapi voices installed, (though I rarely use them), but I haven't played with

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, Marco van de Voort via fpc-pascal wrote: On 26-6-2023 20:26, Michael Van Canneyt via fpc-pascal wrote: I suspect COM is not properly initialized, and that Lazarus does this for you. (it needs com for some components on windows) So, try adding unit windows to the

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Marco van de Voort via fpc-pascal
On 26-6-2023 20:26, Michael Van Canneyt via fpc-pascal wrote: I suspect COM is not properly initialized, and that Lazarus does this for you. (it needs com for some components on windows) So, try adding unit windows to the uses clause and add CoInitialize(nil); as the first statement of

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, Michael Van Canneyt via fpc-pascal wrote: On Mon, 26 Jun 2023, James Richters wrote: I tried to make your example into a FPC program without Lazarus: {$mode objfpc}{$H+} uses comobj; var SavedCW: Word; v: OleVariant; begin v:=CreateOleObject('SAPI.SpVoice');

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, James Richters wrote: I tried to make your example into a FPC program without Lazarus: {$mode objfpc}{$H+} uses comobj; var SavedCW: Word; v: OleVariant; begin v:=CreateOleObject('SAPI.SpVoice'); v.Speak('Hello'); End. I get: Running

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
I was trying to figure this out on my own.. I went to: https://wiki.freepascal.org/SAPI that is where I got my advice. I took the top example code from the link and made it into the following program: {$Mode OBJFPC} uses comobj; var SavedCW: Word; SpVoice: Variant; begin SpVoice :=

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, Travis Siegel via fpc-pascal wrote: Thank you, this one works for me with a command line compile.  I compared the two programs, and the line that asks for the voices is the culprit. I'll have to do some digging to see why that line breaks the runtime execution. Try

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
Thank you, this one works for me with a command line compile.  I compared the two programs, and the line that asks for the voices is the culprit. I'll have to do some digging to see why that line breaks the runtime execution. But at least I can make it work now.  I'd always used powerbasic

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
Does the form code do something different than the command line? When I try to run this code, I get an unhandled exception error. Any idea how to fix? On 6/26/2023 1:54 PM, Michael Van Canneyt via fpc-pascal wrote: On Sun, 25 Jun 2023, James Richters via fpc-pascal wrote: I gave up on

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, Marco van de Voort via fpc-pascal wrote: On 26-6-2023 15:54, Michael Van Canneyt via fpc-pascal wrote:   v.Voice:=v.GetVoices().Item(1); I have to change that to (0) to get it to work. Might depend on configuration? Probably the number of voices installed in the

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Rik van Kekem via fpc-pascal
Op 25-06-2023 om 22:46 schreef James Richters via fpc-pascal: I gave up on doing it directly, it seems SO convoluted to do with FPC with the COM unit and all this stuff I just don’t understand, and it’s SO simple to do with a VBS script in just 3 lines and it just works!(it would only be 2

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Marco van de Voort via fpc-pascal
On 26-6-2023 15:54, Michael Van Canneyt via fpc-pascal wrote:   v.Voice:=v.GetVoices().Item(1); I have to change that to (0) to get it to work. Might depend on configuration? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Sun, 25 Jun 2023, James Richters via fpc-pascal wrote: I gave up on doing it directly, it seems SO convoluted to do with FPC with the COM unit and all this stuff I just don’t understand, and it’s SO simple to do with a VBS script in just 3 lines and it just works! (it would only be 2

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
On Behalf Of Rafael Picanço via fpc-pascal Sent: Sunday, June 25, 2023 2:17 PM To: fpc-pascal@lists.freepascal.org Cc: Rafael Picanço Subject: Re: [fpc-pascal] Microsoft SAPI on Freepascal Hi James, I am not familiar with variants and Ole objects, sorry about that. I found some people using c

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-25 Thread Rafael Picanço via fpc-pascal
Rafael Pican?o) >4. Re: Microsoft SAPI on Freepascal (James Richters) > > > -- > > Message: 1 > Date: Sun, 25 Jun 2023 13:33:24 -0300 > From: Rafael Pican?o > To: fpc-pascal@lists.freepascal.org > Subject: Re: [fpc-pascal]

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-25 Thread James Richters via fpc-pascal
So it’s broken? It seems like the link you provided is trying to show a workaround, but I don’t know how I could apply that. >"Remark Dispatch interface support for variants is currently broken in the >compiler." (https://www.freepascal.org/docs-html/ref/refsu20.html)

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-25 Thread Rafael Picanço via fpc-pascal
Hi James, Sorry, I missed the following reference: "Remark Dispatch interface support for variants is currently broken in the compiler." (https://www.freepascal.org/docs-html/ref/refsu20.html) Best, R > ___ fpc-pascal maillist -

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-25 Thread Rafael Picanço via fpc-pascal
Hi James, > SpVoice : Variant; > SpVoice := CreateOleObject('SAPI.SpVoice') The Free Pascal Variant type does not handle interfaces by default. Take a look: https://wiki.freepascal.org/Variant Best, R ___ fpc-pascal maillist -

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-25 Thread James Richters via fpc-pascal
Ooops forgot the link: https://wiki.lazarus.freepascal.org/SAPI From: fpc-pascal On Behalf Of James Richters via fpc-pascal Sent: Sunday, June 25, 2023 8:52 AM To: 'FPC-Pascal users discussions' Cc: James Richters Subject: [fpc-pascal] Microsoft SAPI on Freepascal I am trying to get

[fpc-pascal] Microsoft SAPI on Freepascal

2023-06-25 Thread James Richters via fpc-pascal
I am trying to get Microsoft speech synthesis to work with Freepascal. I am trying to follow the guide here: I don't know what I am doing wrong. SAPI is working on my system, because the TTSApp Demo that comes with the Microsoft Speech SDK works fine. Here is my test program: {$mode