procedure TForm1.Button1Click(Sender: TObject);
begin
SetLength(Mono16,0); //Array shall hold the sampled data
LiveAudioRecorder1.Active:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
LiveAudioRecorder1.Active:=false;
end;
procedure TForm1.LiveAudioRecorder1Format(Sender: TObject;
out pWaveFormat: PWaveFormatEx; var FreeIt: Boolean);
begin
pWaveFormat^.wFormatTag :=WAVE_FORMAT_PCM;
pWaveFormat^.nChannels :=2;
pWaveFormat^.nSamplesPerSec :=96000;
pWaveFormat^.nAvgBytesPerSec :=96000*4;
pWaveFormat^.nBlockAlign := 4;
pWaveFormat^.wBitsPerSample:=16;
pWaveFormat^.cbSize :=0;
end;
procedure TForm1.LiveAudioRecorder1Format(Sender: TObject;
out pWaveFormat: PWaveFormatEx; var FreeIt: Boolean);
begin
GetMem(pWaveFormat, SizeOf(TWaveFormatEx)); // allocate memory
FreeIt := True; // let the component release the allocated memory
pWaveFormat^.wFormatTag :=WAVE_FORMAT_PCM;
pWaveFormat^.nChannels :=2;
pWaveFormat^.nSamplesPerSec :=96000;
pWaveFormat^.nAvgBytesPerSec :=96000*4;
pWaveFormat^.nBlockAlign := 4;
pWaveFormat^.wBitsPerSample:=16;
pWaveFormat^.cbSize :=0;
end;
procedure TForm1.LiveAudioRecorder1Data(Sender: TObject;
const Buffer: Pointer; BufferSize: Cardinal; var FreeIt: Boolean);
var
B16: array of smallint absolute Buffer;
N,i: integer;
xmax: integer;
begin
LiveAudioRecorder1.Active:=false;
N := BufferSize Div 2;
xmax:=Length(Mono16);
SetLength(Mono16,xmax+N);
For i := 0 to N-1 Do
begin
Mono16[xmax+i]:=B16[i];
end;
Timer2.Enabled:=true;
FreeIt:=true;
end;
Return to DELPHI AREA Projects
Users browsing this forum: No registered users and 3 guests