物
物理
Unregistered / Unconfirmed
GUEST, unregistred user!
最近在做一个用声卡模拟数据采集卡做一个采集分析器,用一些WAVEIN**
函数,有关其中的一些关键技术掌握不够,恳请各位专家不吝赐教
var
Form1: TForm1;
pqWAVEHDRWAVEHDR;
pqphwaveinHWAVEIN;
pqWAVEFORMATEXWAVEFORMATex;
qWAVEFORMATEX:tWAVEFORMATex;
qhwavein:hwavein;
qwavehdr:wavehdr;
pwicwaveincaps;
cbwic:waveincaps;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
// panel1.Caption:=inttostr(mmsystemGetVersion);
panel1.caption:=inttostr(waveInOpen(pqphwavein,WAVE_MAPPER ,pqWAVEFORMATEX,0,0,WAVE_MAPPED ));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
panel1.Caption:=inttostr(qWAVEFORMATEX.wFormatTag);
end;
procedure TForm1.FormCreate(Sender: TObject);
// var mystring:form1.Memo1.Lines;
begin
memo1.Text:=form1.Memo1.Lines.Text;
//错误代码对应
//lphwavein:=0;
//with WAVEFORMATEXdo
//begin
qWAVEFORMATEX.wFormatTag:=WAVE_FORMAT_PCM;//定义WAVEFORMAT结构
qWAVEFORMATEX.nChannels:=0;
qWAVEFORMATEX.nSamplesPerSec:=WAVE_FORMAT_4S16;
qWAVEFORMATEX.nAvgBytesPerSec:=WAVE_FORMAT_4S16*qWAVEFORMATEX.nBlockAlign;
qWAVEFORMATEX.nBlockAlign:=2*2;
panel1.caption:=inttostr(waveInOpen(pqphwavein,WAVE_MAPPER ,pqWAVEFORMATEX,0,0,WAVE_MAPPED ));
//qwaveformatex.wBitsPerSample:=16;
//qwaveformatex.cbSize:=0;
//end;
with qwavehdrdo
//定义WAVEHDR结构
begin
//lpdata:=pqwavehdr;
dwbufferlength:=2000;
dwBytesRecorded:=1000;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
waveInOpen(pqphwavein,WAVE_MAPPER,pqWAVEFORMATEX,0,0,WAVE_FORMAT_QUERY)
panel1.caption:=inttostr(waveInAddBuffer(waveInGetNumDevs,pqWAVEHDR ,100));
//panel1.caption:=inttostr(wavehdr.dwBufferLength );
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
panel1.caption:=inttostr(waveinstart(qhwavein));
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
panel1.caption:=inttostr(waveInPrepareHeader(qhwavein,pqwavehdr,2000));
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
//panel1.caption:=inttostr(waveInGetDevCaps(WAVE_MAPPER,pwaveincaps,sizeof(cbwic)));
panel1.caption:=inttostr(WAVE_MAPPER);
end;
end.
运行有问题
主要是内存的,有兴趣的和我探讨
E_MAIL: tju_2001@eyou.com
函数,有关其中的一些关键技术掌握不够,恳请各位专家不吝赐教
var
Form1: TForm1;
pqWAVEHDRWAVEHDR;
pqphwaveinHWAVEIN;
pqWAVEFORMATEXWAVEFORMATex;
qWAVEFORMATEX:tWAVEFORMATex;
qhwavein:hwavein;
qwavehdr:wavehdr;
pwicwaveincaps;
cbwic:waveincaps;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
// panel1.Caption:=inttostr(mmsystemGetVersion);
panel1.caption:=inttostr(waveInOpen(pqphwavein,WAVE_MAPPER ,pqWAVEFORMATEX,0,0,WAVE_MAPPED ));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
panel1.Caption:=inttostr(qWAVEFORMATEX.wFormatTag);
end;
procedure TForm1.FormCreate(Sender: TObject);
// var mystring:form1.Memo1.Lines;
begin
memo1.Text:=form1.Memo1.Lines.Text;
//错误代码对应
//lphwavein:=0;
//with WAVEFORMATEXdo
//begin
qWAVEFORMATEX.wFormatTag:=WAVE_FORMAT_PCM;//定义WAVEFORMAT结构
qWAVEFORMATEX.nChannels:=0;
qWAVEFORMATEX.nSamplesPerSec:=WAVE_FORMAT_4S16;
qWAVEFORMATEX.nAvgBytesPerSec:=WAVE_FORMAT_4S16*qWAVEFORMATEX.nBlockAlign;
qWAVEFORMATEX.nBlockAlign:=2*2;
panel1.caption:=inttostr(waveInOpen(pqphwavein,WAVE_MAPPER ,pqWAVEFORMATEX,0,0,WAVE_MAPPED ));
//qwaveformatex.wBitsPerSample:=16;
//qwaveformatex.cbSize:=0;
//end;
with qwavehdrdo
//定义WAVEHDR结构
begin
//lpdata:=pqwavehdr;
dwbufferlength:=2000;
dwBytesRecorded:=1000;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
waveInOpen(pqphwavein,WAVE_MAPPER,pqWAVEFORMATEX,0,0,WAVE_FORMAT_QUERY)
panel1.caption:=inttostr(waveInAddBuffer(waveInGetNumDevs,pqWAVEHDR ,100));
//panel1.caption:=inttostr(wavehdr.dwBufferLength );
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
panel1.caption:=inttostr(waveinstart(qhwavein));
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
panel1.caption:=inttostr(waveInPrepareHeader(qhwavein,pqwavehdr,2000));
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
//panel1.caption:=inttostr(waveInGetDevCaps(WAVE_MAPPER,pwaveincaps,sizeof(cbwic)));
panel1.caption:=inttostr(WAVE_MAPPER);
end;
end.
运行有问题
主要是内存的,有兴趣的和我探讨
E_MAIL: tju_2001@eyou.com