码迷,mamicode.com
首页 > 其他好文 > 详细

网友分享 调用dll的语音朗读 不能变速,不好

时间:2015-10-22 16:55:49      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:

调用   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;externalspeeker.dll;
procedure CreatTTS(h:hwnd);stdcall;externalspeeker.dll;
procedure Speak(var words:widechar);stdcall;externalspeeker.dll;
procedure FreeMe();stdcall;externalspeeker.dll;
function  GetTokens_num:integer;stdcall;externalspeeker.dll;
procedure SetToken_i(i:integer);stdcall;externalspeeker.dll;
function  GetToken_i(i:integer):PAnsichar;stdcall;externalspeeker.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

 

网友分享 调用dll的语音朗读 不能变速,不好

标签:

原文地址:http://www.cnblogs.com/rogge7/p/4901230.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!