Delphi - OLE类实现TTS方式语音朗读
2021-05-18 02:28
标签:win api sage variant window sse span dct 实现 直接看代码: 看效果: Delphi - OLE类实现TTS方式语音朗读 标签:win api sage variant window sse span dct 实现 原文地址:https://www.cnblogs.com/jeremywucnblog/p/11758084.htmlDelphi调用OLE类实现TTS方式语音朗读
unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Comobj,
Dialogs, StdCtrls, RzButton;
type
TFrmMain = class(TForm)
btnStart: TRzBitBtn;
mmMsg: TMemo;
procedure btnStartClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmMain: TFrmMain;
implementation
{$R *.dfm}
procedure TFrmMain.btnStartClick(Sender: TObject);
var
voice: OLEVariant;
begin
voice := CreateOLEObject(‘SAPI.SpVoice‘);
voice.Speak(mmMsg.Lines.Text, 0);
end;
end.