{ 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] <> ''dobegin if Utilities.SoundCheck then if Speaker > 0 thenbegin
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 ifnot SoundCheck thenbegin
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.
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
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.