天大的怪事!!!!!(50分)

  • 主题发起人 主题发起人 RGKJ
  • 开始时间 开始时间
R

RGKJ

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在做一个简单的语音读数程序.
代码如下:
uses MMSystem;
var
wDeviceID: word;

procedure Tform1.PlayVoice(filename: string);//播放指定的WAV文件
var
mciOpenParms: TMCI_Open_Parms;
mciPlayParms: TMCI_Play_Parms;
begin

if waveOutGetNumDevs < 1 then
{ Any devices? }
ShowMessage('No wave devices available!')
else

begin

FillChar(mciOpenParms,
SizeOf(TMCI_Open_Parms), 0);
FillChar(mciPlayParms,
SizeOf(TMCI_Play_Parms), 0);

with mciOpenParmsdo
{ Set MCI to play WAV files }
begin

lpStrDeviceType := 'waveaudio';
lpstrElementName :=pchar(filename);
end;

if mciSendCommand(0, MCI_OPEN,
MCI_OPEN_TYPE or MCI_OPEN_ELEMENT,
Longint(@mciOpenParms)) = 0 then
{ Open Device }
begin

wDeviceID := mciOpenParms.wDeviceID;
{ Grab Device ID for later }

//mciPlayParms.dwCallback := Handle;
{ Set our Handle for Callback message }
//mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY,LongInt(@mciPlayParms));
{ Kick off play of File;
await message }
end;

end;

end;

procedure Tform1.CloseDevice;
begin

mciSendCommand(wDeviceID,MCI_CLOSE, 0, 0);
end;


procedure TForm1.Button2Click(Sender: TObject);
begin

PlayVoice('e:/voice/1.wav');
sleep(1000);
PlayVoice('e:/voice/2.wav');
sleep(1000);
closedevice;
end;



运行程序后,第一次按下按钮能正确地连续读出两个文件,
可是,当我再按一下按钮时却过了几秒钟读出第二个文件,而不读第一个文件,
我再按,仍然只读第二个文件,后我有多加几个文件,依然如此,第一次按正常,再按就只读最后一个文件,为什么?
请各位大虾指点.
 
这个问题没有能帮忙吗?
 
没搞过。
帮你顶一下
 

Similar threads

S
回复
0
查看
896
SUNSTONE的Delphi笔记
S
S
回复
0
查看
873
SUNSTONE的Delphi笔记
S
后退
顶部