[fpc-pascal] Array as result in function.
silvioprog at gmail.com
Sat Jan 21 01:06:10 CET 2017
On Fri, Jan 20, 2017 at 7:36 PM, fredvs <fiens at hotmail.com> wrote:
> Ok, thanks Silvio, I will take this one from your advice, it works like
> TOggOpusFile = THandle;
Hm... you should keep the same C data types. :-) I took a look at
`OggOpusFile` type, it is a struct:
so on Pascal it makes more sense declared as:
POggOpusFile = ^OggOpusFile;
OggOpusFile = record
op_read: function(OpusFile: POggOpusFile; ...
`PDArFloat` seems OK to `op_read_float`, but notice last comment regarding
"li: pointer" should be "li: pcint" in both funcs.
go slowly: these changes can raise new errors on your code. :-)
TDArFloat = array of cfloat;
> PDArFloat = ^TDArFloat;
> op_read: function(OpusFile: TOggOpusFile; pcm : PDArFloat; SampleCount:
> Integer; li: pointer): Integer;
`_pcm` on original code is an `int16` buffer... consider to using `cint16`:
op_read_float: function(OpusFile: TOggOpusFile; pcm : PDArFloat;
> SampleCount: Integer; li: pointer): Integer;
> Many thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal