语音聊天难题(100分)

  • 主题发起人 主题发起人 kaolaxiong
  • 开始时间 开始时间
K

kaolaxiong

Unregistered / Unconfirmed
GUEST, unregistred user!
有谁知道语音聊天是怎么实现的?
 
acm控件,你去下载一个拉!!
 
能不能告诉怎么用呀,可以支持多人同时聊天吗,支持视频聊天吗
 
兄弟,搜索一下先?
很多的
 
unit ipunit;

interface

uses
Windows, SysUtils, Classes, Controls, Forms,
ACMWaveOut,mmsystem, ACMWaveIn, ACMDialog, StdCtrls,
Graphics, ExtCtrls, ComCtrls, Sockets, IdBaseComponent,
IdComponent, IdUDPBase, IdUDPServer,IdSocketHandle, IdUDPClient;

type
TForm1 = class(TForm)
ACMDialog1: TACMDialog;
ACMWaveIn1: TACMWaveIn;
ACMWaveOut1: TACMWaveOut;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
IdUDPServer1: TIdUDPServer;
IdUDPClient1: TIdUDPClient;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ACMWaveIn1Data(data: Pointer;
size: Integer);
procedure IdUDPServer1UDPRead(Sender: TObject;
AData: TStream;
ABinding: TIdSocketHandle);
private
{ Private declarations }
public
{ Public declarations }
end;


var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var format:pointer;
begin

format:=ACMDialog1.OpenDialog;
if format=nil then
exit;
IdUDPServer1.Active:=true;
ACMWaveOut1.Open(format);
ACMWaveIn1.Open(format);
Button1.Enabled:=false;
Button2.Enabled:=true;
end;


procedure TForm1.Button2Click(Sender: TObject);
begin

ACMWaveIn1.Close;
ACMWaveOut1.Close;
IdUDPServer1.Active:=false;
Button1.Enabled:=true;
Button2.Enabled:=false;
end;


procedure TForm1.ACMWaveIn1Data(data: Pointer;
size: Integer);
var
mdata:array[1..400000] of char;
k:integer;
begin

for k:=1 to sizedo
mdata[k]:=pchar(dword(data)+dword(k-1))^;
IdudpServer1.SendBuffer('192.168.245.11',5623,mdata,size);
end;


{var
mdata:array[1..10000] of char;
begin

IdUDPServer1.SendBuffer('192.168.245.11',5623,data,size);
end;
}



procedure TForm1.IdUDPServer1UDPRead(Sender: TObject;
AData: TStream;
ABinding: TIdSocketHandle);
var
DataStringStream: TStringStream;
begin

DataStringStream := TStringStream.Create('');
try
DataStringStream.CopyFrom(AData, AData.Size);
ACMWaveOut1.PlayBack(AData,AData.Size);
finally
DataStringStream.Free;
end;


end;



end.
 
我这里也有acm 控件,上边代码可以听到声音,就是回音太大,不知如何解决。
 
回声大?
不要把话筒对着音箱哈
 
to tl_lyq:
可否发个ACM控件
zwjianf888@sina.com.cn
 
小弟也正在做!希望能交流!
 
后退
顶部