Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread fredvs
Thanks very much for answers. @ silvioprog: > using that function as callback with some (C/C++) library? Yes and check its parameter calling convention is ok. @ Martin. > result:= copy(arrayin); Ha, I did not know this one. I will try it (and write you asap). Many thanks. Fre;D -

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread silvioprog
On Fri, Jan 20, 2017 at 5:14 PM, silvioprog wrote: [...] > > It seems that function just increment the address of a (float) buffer, so: > I meant "It seems that function just fill a (float) buffer". ^^' -- Silvio Clécio ___

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread silvioprog
On Fri, Jan 20, 2017 at 3:45 PM, fredvs wrote: > > Here, for example from OpusFile.h => > > OP_WARN_UNUSED_RESULT int op_read_float(OggOpusFile *_of, > float *_pcm,int _buf_size,int *_li) OP_ARG_NONNULL(1); > > Translated in fpc with: > > op_read: function(OpusFile:

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread silvioprog
On Fri, Jan 20, 2017 at 7:11 PM, fredvs wrote: > Hello Silvio. > > Wow, thanks, I will study it deep. > > By the way, the Opus Pascal wrappers are working. > You may listen, seek, saving to file, apply dsp,.. to Opus files. > You may try SimplePlayer demo in uos (all libraries

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread silvioprog
On Fri, Jan 20, 2017 at 9:06 PM, silvioprog wrote: [...] > `_pcm` on original code is an `int16` buffer... consider to using `cint16`: > Damn Gmail's Ctrl+Enter. -.-' I meant: "`_pcm` on original code is an `int16` buffer... consider to using `*pcint16*`:" -- Silvio

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread silvioprog
On Fri, Jan 20, 2017 at 7:36 PM, fredvs wrote: > Re-hello. > > Ok, thanks Silvio, I will take this one from your advice, it works like > charm: > > type > TOggOpusFile = THandle; > Hm... you should keep the same C data types. :-) I took a look at `OggOpusFile` type, it is a

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread fredvs
Hello Silvio. Wow, thanks, I will study it deep. By the way, the Opus Pascal wrappers are working. You may listen, seek, saving to file, apply dsp,.. to Opus files. You may try SimplePlayer demo in uos (all libraries and Opus-audiofile included): https://github.com/fredvs/uos PS: BufferIn is

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread fredvs
Re-hello. Ok, thanks Silvio, I will take this one from your advice, it works like charm: type TOggOpusFile = THandle; TDArFloat = array of cfloat; PDArFloat = ^TDArFloat; op_read: function(OpusFile: TOggOpusFile; pcm : PDArFloat; SampleCount: Integer; li: pointer): Integer; op_read_float:

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread fredvs
Hello. Some more investigations. Let say we have a array of float of length = 100 (arrayin): setlength(arrayin,100); A external library fill this array with 80 samples (ouframes). When using that arrayin pure (without any dsp) the sound is pure too. If using: function arraycopy(arrayin :

Re: [fpc-pascal] fpc and voip ?

2017-01-20 Thread fredvs
> Maybe you may think in Opus http://opus-codec.org/ Yep, wrappers for libopus and libopusfile are translated and working for fpc. Also Opus is part now of uos (and working). Libraries for Linux64 and Win32 included (for other os, it will come asap). Updated SimplePlayer demo with Opus sample.

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread Sven Barth
Am 20.01.2017 13:18 schrieb "fredvs" : > > Thanks very much for answers. > > @ silvioprog: > > > using that function as callback with some (C/C++) library? > > Yes and check its parameter calling convention is ok. You shouldn't use Pascal arrays when interfacing with C/C++

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread Jürgen Hestermann
Am 2017-01-20 um 07:52 schrieb Martin Schreiber: > On Thursday 19 January 2017 22:50:36 fredvs wrote: >> function array_in_out(arrayin: TArFloat): TArFloat; >> begin >> result := arrayin; >> end; > Do you change items of "arrayin" later? If so the items of the result array > will be changed too,

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread fredvs
Hello. Hum,... I am guilty. ;-( There was a SetLength(Bufferin, x) hidden. So the length of bufferin into the function was not the same as the "pure" one. So, to resume: If using: function arraycopy(arrayin : Tarrayfloat): Tarrayfloat; begin result := arrayin; end; ==> Perfect, the

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread silvioprog
On Fri, Jan 20, 2017 at 1:12 PM, fredvs wrote: [...] Please look at Sven's warn regarding Pascal arrays mixed with C arrays. Could you show us the original C function? -- Silvio Clécio ___ fpc-pascal maillist -

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread fredvs
Here, for example from OpusFile.h => OP_WARN_UNUSED_RESULT int op_read_float(OggOpusFile *_of, float *_pcm,int _buf_size,int *_li) OP_ARG_NONNULL(1); Translated in fpc with: op_read: function(OpusFile: TOggOpusFile; var pcm; SampleCount: Integer; li: pointer): Integer; And used like this:

Re: [fpc-pascal] Drawing bitmap by pixel

2017-01-20 Thread Graeme Geldenhuys
On 2017-01-20 01:50, Ryan Joseph wrote: > The max color value is 65535. I thought it was 1.0 or 255. The FPImage implementation supports 16bit color channels (a bit of future proofing that confuses many). Most programs and images use 8bits per channel. Each color channel is thus a WORD size, not