[fpc-pascal] Can not set voice property of SpVoice
Michael Van Canneyt
michael at freepascal.org
Tue Aug 23 09:22:24 CEST 2016
On Tue, 23 Aug 2016, Toru Takubo wrote:
> I am testing a text to speech program working on Windows SAPI, and I
> encountered a problem that I can not set the Voice property because
> "member not found".
> Below is the code which describe the problem. It is originally from
> the freepascal wiki (http://wiki.freepascal.org/SAPI) and slightly
> modified. Setting the voice property in this code is meaningless,
> I know. It is just to reproduce the problem.
> The SpVoice.Speak method itself works fine. I am working with fpc
> 3.0.0 on Windows 7 64bit. Any advice would be appreciated.
> program TestSAPI;
> SysUtils, comobj;
> SavedCW: Word;
> SpVoice: Variant;
> Token: Variant;
> SpVoice := CreateOleObject('SAPI.SpVoice');
> // Change FPU interrupt mask to avoid SIGFPE exceptions
> SavedCW := Get8087CW;
> Set8087CW(SavedCW or $4);
> Token := SpVoice.Voice; //I can get a voice token.
> Writeln(Token.GetDescription); //The token actually works.
> SpVoice.Voice := Token; //"member not found" exception here. I can't set it.
Did you try
More information about the fpc-pascal