[fpc-pascal] Playing with SpVoice (ole object)

Marco van de Voort marcov at stack.nl
Mon May 12 10:51:56 CEST 2008


> 
> {$mode objfpc}{$H+}
> uses
>    comobj;
> var
>    vsound: olevariant;
>    s: string;
> begin
>    vsound := createoleobject('SAPI.SpVoice');
>    writeln('playing using literal');
>    vsound.speak('hello world');
>    writeln('ok (press enter)');
>    readln;
>    writeln('now playing using a string var');
>    s := 'hello world';
>    vsound.speak(s);
>    writeln('ok (press enter)');
>    readln;
> end.
> 
> speaks using a literal but says randomic words (sometimes says nothing) 
> using a variable. Is there something that I am missing?

I've been thinking of adding some interesting code snippets to the examples
of the winunits package (to which comobj belongs). Do you mind if I add this
to SVN ? (lGPL licensed)



More information about the fpc-pascal mailing list