菜
菜鸟黄
Unregistered / Unconfirmed
GUEST, unregistred user!
请各位大侠帮我解释下以下代码(每步实现的功能)procedure TACMWaveOut.PlayBack(dataointer;size:longint);varHeaderWaveHdr;memblockointer;i:integer;
begin
if HWaveOut1<>nil then
begin
header:=new(PWaveHdr);
memblock:=new(pointer);
getmem(memblock,size);
move(data^,memBlock^,size);
header.lpdata:=memBlock;
header.dwbufferlength:=size;
header.dwbytesrecorded:=size;
header.dwUser:=0;
header.dwflags:=0;
header.dwloops:=0;
i:=WaveOutPrepareHeader(HWaveOut1^,header,sizeof(TWaveHdr));
if i<> 0 then
showmessage('WaveOutPrepareHeader error');
i:=WaveOutWrite(HWaveOut1^,header,sizeof(TWaveHdr));
if i<> 0 then
showmessage('WaveOutWrite error');
end;
begin
if HWaveOut1<>nil then
begin
header:=new(PWaveHdr);
memblock:=new(pointer);
getmem(memblock,size);
move(data^,memBlock^,size);
header.lpdata:=memBlock;
header.dwbufferlength:=size;
header.dwbytesrecorded:=size;
header.dwUser:=0;
header.dwflags:=0;
header.dwloops:=0;
i:=WaveOutPrepareHeader(HWaveOut1^,header,sizeof(TWaveHdr));
if i<> 0 then
showmessage('WaveOutPrepareHeader error');
i:=WaveOutWrite(HWaveOut1^,header,sizeof(TWaveHdr));
if i<> 0 then
showmessage('WaveOutWrite error');
end;