Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#7

Re: Speech Api- texte vorlesen

  Alt 12. Jun 2008, 18:19
Z.B. so:

Delphi-Quellcode:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
  SpeechLib_TLB, OleServer, ComCtrls, OleCtrls, ShellApi;
//--------------------------------------------------------------

procedure TForm1.FormCreate(Sender: TObject);
var I: Integer; SOTokens: ISpeechObjectTokens;
begin
  SOTokens := SpVoice1.GetVoices('', '');
  for I := 0 to SOTokens.Count - 1 do
  ListBox1.Items.Add(SOTokens.Item(I).GetDescription(0));
  ListBox1.ItemIndex := ListBox1.Items.IndexOf(SpVoice1.Voice.GetDescription(0));
  ListBox1.OnClick(ListBox1);
  SpVoice1.Volume:= 60;
  SpVoice1.Voice := SpVoice1.GetVoices('', '').Item(1);
  Label1.Caption:= 'Ausgewählte Stimme : '+ SpVoice1.Voice.GetDescription(0);
end;

procedure TForm1.ListBox1Click(Sender: TObject);
begin
  SpVoice1.Voice := SpVoice1.GetVoices('', '').Item(ListBox1.ItemIndex);
  Label1.Caption:= 'Ausgewählte Stimme : '+ SpVoice1.Voice.GetDescription(0);
  SpVoice1.Speak('test', SVSFlagsAsync);
end;
  Mit Zitat antworten Zitat