调用 speeker.dll 这个文件被本人 放在文件里面,若有人需要可以 联系我
需要 mfc100ud.dll msvcr100d.dll
注:可以用D7 自带的ActiveX 里面的控件,可以调速,需要安装语音包。
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; ComboBox1: TComboBox; procedure FormDestroy(Sender: TObject); procedure FormShow(Sender: TObject); procedure ComboBox1Change(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; c: pwidechar; m:widechar; implementation {$R *.dfm} function D3DPERF_EndEvent:DWORD;stdcall;external‘speeker.dll‘; procedure CreatTTS(h:hwnd);stdcall;external‘speeker.dll‘; procedure Speak(var words:widechar);stdcall;external‘speeker.dll‘; procedure FreeMe();stdcall;external‘speeker.dll‘; function GetTokens_num:integer;stdcall;external‘speeker.dll‘; procedure SetToken_i(i:integer);stdcall;external‘speeker.dll‘; function GetToken_i(i:integer):PAnsichar;stdcall;external‘speeker.dll‘; procedure MySpeak(s:string); begin stringtowidechar(s,@m, length(s)*2); Speak(m); end; procedure TForm1.Button1Click(Sender: TObject); begin MySpeak(memo1.Lines.Text); end; procedure TForm1.ComboBox1Change(Sender: TObject); begin SetToken_i(ComboBox1.ItemIndex); end; procedure TForm1.FormDestroy(Sender: TObject); begin freeme; end; procedure TForm1.FormShow(Sender: TObject); var i:integer; begin CreatTTS(form1.Handle); for i := 0 to (GetTokens_num-1) do ComboBox1.AddItem(GetToken_i(i),nil); end; end.
object Form1: TForm1 Left = 0 Top = 0 Caption = ‘Form1‘ ClientHeight = 241 ClientWidth = 464 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = ‘Tahoma‘ Font.Style = [] OldCreateOrder = False OnDestroy = FormDestroy OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 object Button1: TButton Left = 40 Top = 200 Width = 113 Height = 33 Caption = #35835 TabOrder = 0 OnClick = Button1Click end object Memo1: TMemo Left = 32 Top = 16 Width = 329 Height = 105 ImeName = #20013#25991‘(‘#31616#20307‘) - ‘#25628#29399#25340#38899#36755#20837#27861 Lines.Strings = ( #35201#35835#30340#25991#23383) TabOrder = 1 end object ComboBox1: TComboBox Left = 40 Top = 144 Width = 145 Height = 21 ImeName = #20013#25991‘(‘#31616#20307‘) - ‘#25628#29399#25340#38899#36755#20837#27861 TabOrder = 2 OnChange = ComboBox1Change end end
时间: 2024-10-23 20:45:20