用多线程放音?150分求解(150分)

  • 主题发起人 主题发起人 lylyly
  • 开始时间 开始时间
L

lylyly

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Makedemo;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,
Tw8vid, ExtCtrls;//引用tw8vid单元
type
TForm1 = class(TForm)
Rdonum: TRadioButton;
Txtnum: TEdit;
BtnStart: TButton;
Btnend: TButton;
Label1: TLabel;
Txtchn: TEdit;
procedure FormCreate(Sender: TObject);
procedure BtnendClick(Sender: TObject);
procedure BtnStartClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
//声明自定义过程
procedure SetVoice();

implementation
{ 以下定义的常量为Tv_MakeSentence服务
注意:顺序不能颠倒!}
const CN_END=0;//end of sentence
const CN_NOTHING=1;//do nothing
const D0=2;const D1=3;const D2=4;const D3=5;const D4=6;//数字0—4
const D5=7;const D6=8;const D7=9;const D8=10;const D9=11;//数字5—9
const TEN=12;
//10
const HUNDTRED=13;
//100
const THOUSAND=14;
//1,000
const THOUSAND_10=15;
//10,000
const MILLI0N_100=16;
//100,000,000
const POINT=17;
//'.'
const NEGATIVE=18;
//'-'
//以下为用户自己定义
const USER_YUAN=19;const USER_JIAO=20;const USER_FEN=21;
var playsentence:Ansistring;//要为长字符串
var chn:integer;//通道号
var BlnEnd:boolean;
var Numchar:Char;
var dblnum:Double;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var Channels:integer;
begin
blnEnd:=False;
Channels:=TV_Installed();
if Channels=0 then
begin
ShowMessage('Tw8vid 驱动程序没有安装!');
Tv_Disable();
application.Terminate;
end;
TV_Initialize();//初始化语音卡
SetVoice();
end;

procedure TForm1.BtnendClick(Sender: TObject);
begin
BlnEnd:=True;
TV_Disable();
Application.Terminate;
end;

procedure TForm1.BtnStartClick(Sender: TObject);
begin
BtnStart.Enabled:=False;
chn:=StrToInt(Txtchn.Text);
if Rdonum.Checked=True then
//读数字
begin
dblnum:=strtofloat(Txtnum.text);
playsentence:=' ';//分配空间,为20.注意空间要足够大
TV_MakeSentence(dblnum,Pchar(playsentence));
TV_PlaySentence(chn,Pchar(playsentence));
repeat
TV_PlaySentenceRest(chn);
Application.ProcessMessages;
until ((TV_PlaySentenceRest(chn)=0) or (BlnEnd=True));
BtnStart.Enabled:=True;
exit;
end;
//end if
end;

//定义过程
procedure setvoice();
begin
//设置各数字的对应语音文件
TV_SetVoicei(CN_END,'');
TV_SetVoicei(CN_NOTHING,'');
TV_SetVoicei(D0,'voice/d0.tw');
TV_SetVoicei(D1,'voice/d1.tw');
TV_SetVoicei(D2,'voice/d2.tw');
TV_SetVoicei(D3,'voice/d3.tw');
TV_SetVoicei(D4,'voice/d4.tw');
TV_SetVoicei(D5,'voice/d5.tw');
TV_SetVoicei(D6,'voice/d6.tw');
TV_SetVoicei(D7,'voice/d7.tw');
TV_SetVoicei(D8,'voice/d8.tw');
TV_SetVoicei(D9,'voice/d9.tw');
TV_SetVoicei(TEN,'voice/Ten.tw');
TV_SetVoicei(HUNDTRED,'voice/Hun.tw');
TV_SetVoicei(THOUSAND,'voice/Thou.tw');
TV_SetVoicei(THOUSAND_10,'voice/th10.tw');
TV_SetVoicei(MILLI0N_100,'voice/M100.tw');
TV_SetVoicei(POINT,'voice/point.tw');
TV_SetVoicei(NEGATIVE,'voice/Negative.tw');
//设置用户自定义的语音文件
TV_SetVoicei(USER_YUAN,'voice/Yuan.tw');
TV_SetVoicei(USER_JIAO,'voice/Jiao.tw');
TV_SetVoicei(USER_FEN,'voice/Fen.tw');
//设置各数字字符的对应语音文件
Numchar:='0';
TV_SetVoicei(ord(Numchar),'voice/d0.tw');//ord(Numchar)为数字0的ASCII码
Numchar:='1';
TV_SetVoicei(ord(Numchar),'voice/d1.tw');
Numchar:='2';
TV_SetVoicei(ord(Numchar),'voice/d2.tw');
Numchar:='3';
TV_SetVoicei(ord(Numchar),'voice/d3.tw');
Numchar:='4';
TV_SetVoicei(ord(Numchar),'voice/d4.tw');
Numchar:='5';
TV_SetVoicei(ord(Numchar),'voice/d5.tw');
Numchar:='6';
TV_SetVoicei(ord(Numchar),'voice/d6.tw');
Numchar:='7';
TV_SetVoicei(ord(Numchar),'voice/d7.tw');
Numchar:='8';
TV_SetVoicei(ord(Numchar),'voice/d8.tw');
Numchar:='9';
TV_SetVoicei(ord(Numchar),'voice/d9.tw');
Numchar:='.';
TV_SetVoicei(ord(Numchar),'voice/point.tw');
Numchar:='-';
TV_SetVoicei(ord(Numchar),'voice/Negative.tw');
end;

end.

请将这个例子的放音部分改成同时3个或4个通道同时放音
 
难道就没有人会吗?
 
我好急的!
望高手指点一二。
 
没是更卵难吧。
高手都到那里去了。
 
真的没人会吗。
死了死了。
 
你想问什么?
这么长的代码没有人愿意看的
 
接受答案了.
 
后退
顶部