Hello.
I usually used this code for get all possible voices in my Windows app:
procedure TForm1.FormShow(Sender: TObject); var i : integer; EngineName : String; begin try SpVoice := TSpVoice.Create(nil); Engines:= TStringList.Create; SpVoice := TSpVoice.Create(nil); SOTokens := SpVoice.GetVoices('', ''); for I := 0 to SOTokens.Count - 1 do begin SOToken := SOTokens.Item(I); EngineName:=SOToken.GetDescription(0); Engines.Add(EngineName); end; ListBox1.Items.AddStrings(Engines); if (ListBox1.Items.Count > 0) then ListBox1.ItemIndex := 0; except on E : Exception do begin Log(E.ClassName+' error raised, with message : '+E.Message); end; end; end;
Unfortunately in Windows 10 in some voices I get an error on line
EOleException error raised, with message : OLE error 8004503A
On line
EngineName:=SOToken.GetDescription(0);
And I can't use Text To Speech correct.
I use SpeechAPI 5.1. I tried get SpeechAPI 5.4 from Windows 10, but when I updated my component it didn't help, I had the same error.
Can anyone help me fix this error? I tried compile this with Delphi XE2u4 and Delphi 10. Both of them has the same result.
Thank you.