Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Delphi/Agenda 1.1/Sources/   (Columbo Version 0.7©)  Datei vom 4.1.2008 mit Größe 2 kB image not shown  

Quelle  reThreads2.pas   Sprache: Delphi

 
unit reThreads2;

interface

uses
  Classes, Dialogs, MMSystem, Utilities, SpeechLib_TLB, Windows ;

type
  TMySpeechThread = class(TThread)
       procedure EnumVoices(VoiceNo:integer);
  private
    { Déclarations privées }
  protected
    procedure Execute; override;
    public
       id : Cardinal;
       sf:array [0..11] of String[240];
       ptr:integer;
       this:integer;
       VoiceRate: integer;
       SpVoice: TspVoice;
       Speaker:integer;
       SOTokens: ISpeechObjectTokens;
  end;

implementation

{ Important : les méthodes et propriétés des objets de la VCL peuvent uniquement
  être utilisés dans une méthode appelée en utilisant Synchronize, comme :

      Synchronize(UpdateCaption);

  où UpdateCaption serait de la forme

    procedure TMyThread.UpdateCaption;
    begin
      Form1.Caption := 'Mis à jour dans un thread';
    end; }

{ TMyThread }

procedure TMySpeechThread.Execute;
begin
  EnumVoices(Speaker);
  while sf[this] <> '' do begin
    if Utilities.SoundCheck then
      if Speaker > 0 then begin
        SpVoice.Voice := SOTokens.Item(Speaker-1);
        SpVoice.Rate:=VoiceRate;
        SpVoice.Speak(sf[this], SVSFDefault)
    end;
    sf[this] := '';
    this := (this + 1) mod 12;
  end;
  Suspend;
end;

//----------------------------------------------------------------
//
//     get voices from machine
//
//----------------------------------------------------------------
procedure TMySpeechThread.EnumVoices(VoiceNo:integer);
var
  i, NoVoices: Integer;
  SOToken: ISpeechObjectToken;
  dwVersion : double;
begin
  if not SoundCheck then begin
    Speaker := 0;
    exit;
  end;
  dwVersion := GetVersion();
  if (dwVersion >= $80000000) then  // no Windows XP
  begin
    Speaker := 0;
    exit;
  end;
  SpVoice := TSpVoice.Create(nil);
  //enter silent mode
  //Ensure all events fire
  SpVoice.EventInterests := SVEAllEvents;
  SOTokens := SpVoice.GetVoices('''');
  NoVoices := SOTokens.Count - 1;
  for I := 0 to NoVoices do
  begin
    //For each voice, store the descriptor in the TStrings list
    SOToken := SOTokens.Item(I);
    //Increment the descriptor reference count to ensure it doesn't get destroyed
    SOToken._AddRef;
  end;
  Speaker := VoiceNo;
end;

end.



89%


¤ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.