On Thu, Jan 19, 2017 at 6:50 PM, fredvs <fi...@hotmail.com> wrote: > Hello. > > With this code, the result of the function does not have same format as the > array input: > > Why ? > > type > TArFloat = array of cfloat; > > function array_in_out(arrayin: TArFloat): TArFloat; > begin > result := arrayin; > end; >
It works fine here. Eg: === begin code === type TArFloat = array of cfloat; function array_in_out(arrayin: TArFloat): TArFloat; var i: byte; begin for i := low(arrayin) to high(arrayin) do arrayin[i] *= 10; Result := arrayin; end; ... var item: cfloat; thebuffer: TArFloat; begin SetLength(thebuffer, 3); thebuffer[0] := 1; thebuffer[1] := 2; thebuffer[2] := 3; WriteLn('before'); for item in thebuffer do WriteLn(item.ToString); thebuffer := array_in_out(thebuffer); WriteLn('after x10'); for item in thebuffer do WriteLn(item.ToString); end; // output: before 1 2 3 after x10 10 20 30 === end code === > Some more explaination. > > If in a code I use: > var > thebuffer: TArFloat; > > // thebuffer was filled with some float-samples > > thebuffer := array_in_out(thebuffer); > > It is not neutral, the data are affected (in audio the data are noisy). > > What is wrong ? > Are you using that function as callback with some (C/C++) library? If so, check its parameter calling convention, declaring it as `function array_in_out(arrayin: TArFloat): TArFloat; cdecl;`. > Thanks. > > Fre;D -- Silvio Clécio
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal