首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

语音开发包解决方案

2012-02-28 
语音开发包科飞的语音软件不错,用着很好,不到谁有针对Delphi的开发包?[解决办法]例程中都有,好好看看吧Del

语音开发包
科飞的语音软件不错,用着很好,不到谁有针对Delphi的开发包?

[解决办法]
例程中都有,好好看看吧

Delphi(Pascal) code
unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls;type  TForm1 = class(TForm)    Memo1: TMemo;    Button1: TButton;    Button2: TButton;    Button3: TButton;    Button4: TButton;    OpenDialog1: TOpenDialog;    procedure Button1Click(Sender: TObject);    procedure Button2Click(Sender: TObject);    procedure Button3Click(Sender: TObject);    procedure FormDestroy(Sender: TObject);  private    { Private declarations }  public    { Public declarations }  end;var  Form1: TForm1;implementation{$R *.dfm}//'================================================================//' STTS Api 声明//'================================================================//' 初始化function STTSInit():boolean;stdcall; external 'STTSApi.dll';//' 逆初始化function STTSDeinit():boolean;stdcall;external 'STTSApi.dll';//' 建立与TTS服务器的连接function  STTSConnect(sSerialNumber:string;sServerIP:string):Integer;stdcall;external 'STTSApi.dll';//' 断开与TTS服务器的连接Function STTSDisconnect(hTTSInstance:Integer):boolean;stdcall;external 'STTSApi.dll';//' 设置本次连接的合成参数Function STTSSetParam(hTTSInstance:integer;lngType:integer;lngParam:integer):Boolean;stdcall;external 'STTSApi.dll';//' 获得本次连接的合成参数Function STTSGetParam(hTTSInstance:Integer;lngType:integer;lngParam:integer):Boolean;stdcall;external 'STTSApi.dll';//' 从字符串合成到音频文件Function STTSString2AudioFile(hTTSInstance:Integer;sString:string;sWaveFile:string):Boolean;stdcall;external 'STTSApi.dll';//' 从文本文件合成到音频文件Function STTSFile2AudioFile(hTTSInstance:Integer;sTextFile:string;sWaveFile:string):Boolean;stdcall;external 'STTSApi.dll';//'播放字符串Function STTSPlayString(hTTSInstance:Integer;sString:string;bAsynch:Boolean):Boolean;stdcall;external 'STTSApi.dll';//'播放文本文件Function STTSPlayTextFile(hTTSInstance:Integer;sTextFile:string;bAsynch:Boolean):Boolean;stdcall;external 'STTSApi.dll';//'播放停止Function STTSPlayStop():Boolean;stdcall;external 'STTSApi.dll';//'查询播放状态Function STTSQueryPlayStatus(lngStatus:Integer):Boolean;stdcall;external 'STTSApi.dll';//'TTS版本信息Function STTSAbout(sAboutInfo:string;ninfosize:Integer):Boolean;stdcall;external 'STTSApi.dll';//' 用来获取错误代码的Windows API函数//Public Declare Function GetLastError Lib "kernel32" () As Longprocedure TForm1.Button1Click(Sender: TObject);varmyhandle:integer;beginSTTSInit();myhandle:=STTSconnect('80','127.0.0.1');STTSPlayString(myhandle,self.Memo1.Text,true) ;STTSDisconnect(myhandle);end;procedure TForm1.Button2Click(Sender: TObject);beginSTTSPlayStop();end;procedure TForm1.Button3Click(Sender: TObject);varstrls:string;myhandle:integer;beginif not self.OpenDialog1.Execute then exit;strls:=self.OpenDialog1.FileName;STTSInit();myhandle:=STTSconnect('80','127.0.0.1');STTSPlayTextFile(myhandle,strls,true);STTSDisconnect(myhandle);end;procedure TForm1.FormDestroy(Sender: TObject);beginSTTSDeInit();end;end. 

热点排行