[fpc-pascal] SpVoice.GetVoices returned exception class EOleSysError
andrewd207 at aol.com
Tue Apr 11 21:23:32 CEST 2017
On 04/10/2017 02:58 AM, misabov wrote:
> The project has generated an exception class EOleSysError with a message:
> ???? ?????? ?? ??????.
> SpVoice: Variant;
> SpVoice := CreateOleObject('SAPI.SpVoice');
> SpVoice.Voice:= SpVoice.GetVoices('','').Item(0);
> SpVoice GetVoices method (SAPI 5.3) cannot return a selection of voices
> available to the voice.
A long time ago I played with MS sapi. I will try to put the relevant
code here for you. My goal was to put the output speech into memory to
be processed further. I attached the generated speechlib_tlb unit. I
think I used the fpc tool importtl to generate this unit. But its been a
long time. The file is dated 2002.
OleServer, ComObj, Speechlib_tlb, Windows, Variants, ActiveX, ...
Voice := TSpVoice.Create(self);
CoCreateInstance(CLASS_SpVoice, nil, CLSCTX_ALL, IID_ISpeechVoice,
Voices := Voice.GetVoices('','');
VoiceList := TStringList.Create;
for i := 0 to Voices.Get_Count -1 do
Voice.Voice := ISpeechObjectToken(Pointer(VoiceList.Objects)); //
0 is the index of the desired voice.
// VoiceList.Strings[x] is a text description of the voice
ToSpeak := 'Hello MS SAPI';
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 431830 bytes
Desc: not available
More information about the fpc-pascal