[fpc-pascal] Adding a array of float in ressource and use it ?

Michael Van Canneyt michael at freepascal.org
Mon Mar 6 17:00:58 CET 2017



On Mon, 6 Mar 2017, fredvs wrote:

>> I don't know. By all logic, it should not work either.
>
> OK, It comes from a "lucky" bug (thanks to reveal it).
> There was a setlength(buffer, length(buffer) * channels) not needed.
>
> Ok, fixed.
>
> But the problem remain:
>
> If data are int16 or int32: OK, the file is created with +- 1 mega bytes and
> I can get those data back.
>
> But if data are float32: NOT OK, the file is created but with only 6 octets
> ;-( . 
>
> For example, 
>
> for x :=0 to length(bufferfloat) -1 do 
> bufferfloat[x] := 127 ; // for int16 ---> it works
>
> for x :=0 to length(bufferfloat) -1 do 
> bufferfloat[x] := 2147483646;  // for int32 ---> it works
>
> for x :=0 to length(bufferfloat) -1 do 
> bufferfloat[x] := 0.2147483646 ; // for float32 ----> it does not work

If the bufferfloat is the same variable in all cases, there should be no difference
whatsoever. The write operation doesn't care a fig about the actual contents of the buffer.

Michael.



More information about the fpc-pascal mailing list