selas
asked on
How to stream mic audio through network?
i want to stream mic-in audio through network
how to do it?
that i need to use?
how to do it?
that i need to use?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well you could use indy IdTCPClient IdTCPServer and the readstream writestream functions
procedure SendToServer;
var
Client: TIdTCPClient;
AudioStream: TMemoryStream;
begin
AudioStream := TMemoryStream.Create;
While Playing do
begin
AudioStream.Position := 0;
....Code to put Audio into stream...
Client := TIdTCPClient.Create(nil);
Client.Host := SERVER_HOST;
Client.Port := SERVER_PORT;
Client.WriteStream(AudioSt ream, True, True);
end;
AudioStream.Free;
end;
procedure OnExecute(AThread: TIdThread);
var
AudioStream: TMemoryStream;
iSize: Integer;
begin
AudioStream := TMemoryStream.Create;
iSize := AThread.Connection.ReadInt eger;
AThread.Connection.ReadStr eam(AudioS tream, iSize);
...Code the move the streamed audio into a buffer..
AudioStream.Free;
end;
Its probably not an ideal solution, but would do the job. you could tell to write directly to a audio buffer of type TMemoryStream and when the buffer reaches a predetermined size the player started reading from the buffer until the end is reached or the buffer is empty and it needs to wait
procedure SendToServer;
var
Client: TIdTCPClient;
AudioStream: TMemoryStream;
begin
AudioStream := TMemoryStream.Create;
While Playing do
begin
AudioStream.Position := 0;
....Code to put Audio into stream...
Client := TIdTCPClient.Create(nil);
Client.Host := SERVER_HOST;
Client.Port := SERVER_PORT;
Client.WriteStream(AudioSt
end;
AudioStream.Free;
end;
procedure OnExecute(AThread: TIdThread);
var
AudioStream: TMemoryStream;
iSize: Integer;
begin
AudioStream := TMemoryStream.Create;
iSize := AThread.Connection.ReadInt
AThread.Connection.ReadStr
...Code the move the streamed audio into a buffer..
AudioStream.Free;
end;
Its probably not an ideal solution, but would do the job. you could tell to write directly to a audio buffer of type TMemoryStream and when the buffer reaches a predetermined size the player started reading from the buffer until the end is reached or the buffer is empty and it needs to wait
alc4emy5t: you haven't checked my example :P
ASKER
// ....Code to put Audio into stream...
what code should be to add mic audio to stream?
and i get error on -> While Playing do
what code should be to add mic audio to stream?
and i get error on -> While Playing do
my example for streaming audio is the exact thing he asked about .. a working example that's been used by many :)
oh . the binaries are in the VoIP.zip file :) VoIP_src.zip are only the sources