El 13/12/2016 a las 0:48, fredvs escribió:

IMO, the problem does not come from PortAudio but from
TFileStream.WriteBuffer that does not have enough RAM for writing.
But maybe I do not catch something :-(

Hello,

In your code you were writing from uos to TMemoryStream (RAM) and when finished copy everything to TFileStream (Disk), so instead the TMemoryStream use a TFileStream and skip the last copy. Of course you may need to rewrite file header when the process is finished.

Currently (pseudo code):

TMemoryStream.Create;
while Recording do begin
  TMemoryStream.Write(AudioBuffer);
end;
TFileStream.Create;
TFileStream.CopyFrom(TMemoryStream);
TFileStream.Free;
TMemoryStream.Free;

So change it by:

TFileStream.Create;
while Recording do begin
  TFileStream.Write(AudioBuffer);
end;
// Here you may need to rewrite file header (if any).
TFileStream.Free;


--

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to