copy data from buffer to memo

Please discuss general Delphi programming topics here.

copy data from buffer to memo

Postby Ali_Reza_Nazari » March 19th, 2009, 9:10 pm

hi
i want to copy data from buffer to memo i this procedure :

procedure TForm1.LiveAudioRecorder1Data(Sender: TObject;
const Buffer: Pointer; BufferSize: Cardinal; var FreeIt: Boolean);
begin
end;

can i do it?
convert buffer to data like 127,120,140,12,...... in to a memo?
---------
Programming with :
basic,c,c++,pascal in dos
delphi , flash action script , vb.net , asp.net
website designer with asp.net
my site (online menu builder for your website or weblog): http://www.cms4menu.ir
if you want to have a good dynamic menu for free please contact with me : Admin@cms4menu.ir
i make menu of my site just with my site
Ali_Reza_Nazari
Member
Member
 
Posts: 2
Joined: March 14th, 2009, 2:12 pm
Location: iran

Re: copy data from buffer to memo

Postby Kambiz » March 20th, 2009, 12:00 am

Although that is not a good idea but here is an example.

Code: Select all
function BytesToString(B: PByte; Count: Cardinal): String;
var
  I: Integer;
begin
  Result := '';
  for I := 1 to Count do
  begin
    if Result <> '' then Result := Result + ',';
    Result := Result + IntToStr(B^);
    Inc(B);
  end;
end;

procedure TForm1.LiveAudioRecorder1Data(Sender: TObject;
  const Buffer: Pointer; BufferSize: Cardinal; var FreeIt: Boolean);
begin
  Memo1.Lines.Add(BytesToString(PByte(Buffer), BufferSize);
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: copy data from buffer to memo

Postby Ali_Reza_Nazari » March 21st, 2009, 8:46 pm

OK
hi.
tanks
that is good for me, because
i dont know
(P+1)* IN CPP equal ????? IN DELPHI?
and now i know

I am find another simple code
Code: Select all
procedure This(Buffer: Pointer; var Len: Integer);
var
mystr: string;
begin
SetLength(mystr, Len);
Move(Buffer^, mystr[1], Len);
end;

--------------------------------

and for reverse action? how can i do?

-------------------------------
i want to write a chat program, i make a text chat, now for video chat i must first send and recieve sound from sockets and then send/recieve pictures(vodeo)
AND now, i want to compress OR analyze sound for less traffic for audio data. in minimum 8bit8000 pcm, i must send 800 Byte pers second and it is not good, i must send at maximum 1 or 2 KB per second, i think if i divide data to half, and delete other half, in replase with (127) in dest, may be can to do less traffic

my friend tell me that i must use VCLZIP to compress data,

please help me to write this program
thanks
---------
Programming with :
basic,c,c++,pascal in dos
delphi , flash action script , vb.net , asp.net
website designer with asp.net
my site (online menu builder for your website or weblog): http://www.cms4menu.ir
if you want to have a good dynamic menu for free please contact with me : Admin@cms4menu.ir
i make menu of my site just with my site
Ali_Reza_Nazari
Member
Member
 
Posts: 2
Joined: March 14th, 2009, 2:12 pm
Location: iran


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron