[fpc-pascal] Adding a array of float in ressource and use it ?
fredvs
fiens at hotmail.com
Wed Mar 8 19:57:35 CET 2017
> can't you have spreading incorrect information on C
Hello.
Some more infos about the problem of our C friends
It seams that for C compilers (Clang, gcc, c++, VS,...) the way to order the
data with a TFileStream differs (not same x-endians) for encoding float.
So you must do it by code and know what compiler was used for the
client-program .
For a file created with a TFileStream of gcc but that will be used by a
program compiled with VS, you should
convert the data from little endian to native ordering (or reverse) with
something like:
for i := 0 to nSamples-1 do
b egin
PCMIn[i] := (pcm_bytes[2*i+1] shl 8) or pcm_bytes[2*i];
end;
And this the reason why, for storing data, they prefer to use integer 32 bit
(where it seams that all compilers use the same order).
Voila.
But it is not our problem, so thank for everything and good luck to our C
friends and their endians.
Fre;D
-----
Many thanks ;-)
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Adding-a-array-of-float-in-ressource-and-use-it-tp5727765p5727819.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
More information about the fpc-pascal
mailing list