L
lt_wxy
Unregistered / Unconfirmed
GUEST, unregistred user!
发送端代码:
procedure TRecorderForm.MMWimData(var msg: TMessage);
var
LTPwavehdrWAVEHDR;
buf:array[0..4128] of Char;
begin
//do
ne recording buffer, write it out
LTPwavehdr := PWAVEHDR(msg.lparam);
if FRecorderMode <> recModeOff then
begin
waveInAddBuffer(FWaveIn, LTPwavehdr, sizeof(TWAVEHDR))
CopyMemory(@buf[0], LTPwavehdr ,32);
CopyMemory(@buf[sizeof(TWAVEHDR)],LTPwavehdr.lpData ,4096);
// showmessage(inttostr(sizeof(TWAVEHDR)));
udpc.SendBuffer('218.12.77.188',3332,buf, 4128);
end
else
CloseWaveDeviceRecord;
// stop recording...
end;
end.
接收端代码:
procedure TRecorderForm.UDPSUDPRead(Sender: TObject;
AData: TStream;
ABinding: TIdSocketHandle);
var Buf :array[0..WAVE_BUFSIZE+sizeof(WAVEHDR)] of Char;
MyStream: TMemoryStream;
LpHead: PWAVEHDR;
str:string
begin
FillChar(Buf,sizeof(Buf),0);
AData.Read(Buf,Adata.Size);
LpHead:=PWAVEHDR(@Buf[0]);
LpHead.lpData:=@Buf[sizeof(WAVEHDR)];
label1.Caption:=inttostr(LpHead.dwBytesRecorded);
label2.Caption:=datetimetostr(Now);
label3.Caption:=inttostr(sizeof(buf));
waveOutPrepareHeader(FWaveOut, LpHead, sizeof(TWAVEHDR));
waveOutWrite(FWaveOut,LpHead,FWaveBufSize)
end;
用上面的接收的代吗可以正确接收VC程序发出的声音,但接不到上面发送端发出的声音不知为什么,请大家帮帮看一下。Email:Lt_wxy@163.com.谢谢。
procedure TRecorderForm.MMWimData(var msg: TMessage);
var
LTPwavehdrWAVEHDR;
buf:array[0..4128] of Char;
begin
//do
ne recording buffer, write it out
LTPwavehdr := PWAVEHDR(msg.lparam);
if FRecorderMode <> recModeOff then
begin
waveInAddBuffer(FWaveIn, LTPwavehdr, sizeof(TWAVEHDR))
CopyMemory(@buf[0], LTPwavehdr ,32);
CopyMemory(@buf[sizeof(TWAVEHDR)],LTPwavehdr.lpData ,4096);
// showmessage(inttostr(sizeof(TWAVEHDR)));
udpc.SendBuffer('218.12.77.188',3332,buf, 4128);
end
else
CloseWaveDeviceRecord;
// stop recording...
end;
end.
接收端代码:
procedure TRecorderForm.UDPSUDPRead(Sender: TObject;
AData: TStream;
ABinding: TIdSocketHandle);
var Buf :array[0..WAVE_BUFSIZE+sizeof(WAVEHDR)] of Char;
MyStream: TMemoryStream;
LpHead: PWAVEHDR;
str:string
begin
FillChar(Buf,sizeof(Buf),0);
AData.Read(Buf,Adata.Size);
LpHead:=PWAVEHDR(@Buf[0]);
LpHead.lpData:=@Buf[sizeof(WAVEHDR)];
label1.Caption:=inttostr(LpHead.dwBytesRecorded);
label2.Caption:=datetimetostr(Now);
label3.Caption:=inttostr(sizeof(buf));
waveOutPrepareHeader(FWaveOut, LpHead, sizeof(TWAVEHDR));
waveOutWrite(FWaveOut,LpHead,FWaveBufSize)
end;
用上面的接收的代吗可以正确接收VC程序发出的声音,但接不到上面发送端发出的声音不知为什么,请大家帮帮看一下。Email:Lt_wxy@163.com.谢谢。