大家可以帮我看一下下面错在那
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, NMUDP ,ACMWaveOut, ACMWaveIn, ACMDialog, StdCtrls;
type
TForm1 = class(TForm)
NMUDP1: TNMUDP;
Button1: TButton;
Button2: TButton;
ACMDialog1: TACMDialog;
ACMWaveIn1: TACMWaveIn;
ACMWaveOut1: TACMWaveOut;
procedure Button1Click(Sender: TObject);
procedure ACMWaveIn1Data(data: Pointer; size: Integer);
procedure FormCreate(Sender: TObject);
procedure NMUDP1DataReceived(Sender: TComponent; NumberBytes: Integer;
FromIP: String; Port: Integer);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Const
BufLen:Integer=1024*1024;
Type
Buffer=Array[1..1] of char;
BufPointer=^Buffer;
Var
MemStream:TMemoryStream;
Buf:^Buffer;
procedure TForm1.FormCreate(Sender: TObject);
begin
GetMem(Buf,BufLen);
end;
procedure TForm1.Button1Click(Sender: TObject);
var format
ointer;
begin
GetMem(Buf,BufLen);
format:=ACMDialog1.OpenDialog;
if format=nil then exit;
ACMWaveIn1.Open(format);
ACMWaveOut1.Open(format);
end;
procedure TForm1.ACMWaveIn1Data(data: Pointer; size: Integer);
Var
sent,index,temp:Longint;
begin
temp:=size;
sent:=1;
Index:=1;
While sent<temp do
Begin
nmudp1.SendBuffer(BufPointer(data)[index],Temp);
sent:=sent+1;
index:=index+1;
temp:=temp-1;
End;
end;
procedure TForm1.NMUDP1DataReceived(Sender: TComponent;
NumberBytes: Integer; FromIP: String; Port: Integer);
Var
temp:Longint;
begin
temp:=numberbytes;
ACMWaveOut1.PlayBack(buf,temp);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FreeMem(Buf);
ACMWaveIn1.Close;
ACMWaveOut1.Close;
end;
end.
谢谢!!