[fpc-pascal] TFileStream.WriteBuffer() and RAM used ?

fredvs fiens at hotmail.com
Fri Dec 9 12:15:17 CET 2016


Hello.

Thanks Michael for answer.

> What happens with the buffer in which you had data, this we do not know.

Here is the schema of recording:

1) At creation:
DataRec := TMemoryStream.Create;


2 ) In loop:
...
DataRec.WriteBuffer(InputBuffer[0], Length(InputBuffer)); // RAM used
increase at each loop
...

3) At end of recording:

function WriteWave(FileName: ansistring; aDataRec: TMemoryStream): word;
var
...
  f: TFileStream;
 ...
begin
    f := TFileStream.Create(FileName, fmCreate);
    ...
    f.WriteBuffer(ID, 4);  // add some stuff for wav header.
    ...
    f.CopyFrom(aDataRec.Data, aDataRec.Data.Size);
   ...
   f.free; 

________________________________________


> ... buffer in which you had data

The buffer (InputBuffer) used to get the samples from input device is
re-filed at each loop.
The data of  (InputBuffer) are added to the other buffer (DataRec) used for
WriteWave() (procedure at end of recording) in each loop.

________________________________________

Huh, maybe I did not understand your question.

Thanks.

Fre;D




-----
Many thanks ;-)
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/TFileStream-WriteBuffer-and-RAM-used-tp5727062p5727075.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.


More information about the fpc-pascal mailing list