[fpc-pascal] Microsoft SAPI on Freepascal
james.richters at productionautomation.net
Sun Jun 25 14:51:51 CEST 2023
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:
CRT, Windows, SysUtils, ComObj, Variants, OLEServer, Classes, ActiveX,
SpVoice := CreateOleObject('SAPI.SpVoice');
// Change FPU interrupt mask to avoid SIGFPE exceptions
MyWideString := WideString('Hello, the time is ' + TimeToStr(Now));
SavedCW := Get8087CW;
Set8087CW(SavedCW or $4);
// Restore FPU mask
Writeln('Press Any Key');
Whenever my program gets to:
Even if I hardcode something like:
I always get:
Running "i:\programming\TTS.exe "
Hello, the time is 8:41:27
An unhandled exception occurred at $0041FC90:
EOleError: Variant does not reference an automation object
$00401A8A main, line 21 of i:\programming\TTS.pas
I don't really understand what this means, and I can't find a complete
sample program that I can just compile and run. I feel I must be missing
something but I don't know what it is.
Any help is greatly appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal