[fpc-pascal] Array as result in function.

fredvs fiens at hotmail.com
Fri Jan 20 19:45:46 CET 2017



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:
BufferIn : array of cfloat;

outframes := op_read_float(HandleOF,BufferIn[0],Wantframes *Channels, nil);

The nice thing is that BufferIn can be used for portaudio, soundfile,
mpg123, aac buffers and is working like charm.

Fre;D




-----
Many thanks ;-)
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Array-as-result-in-function-tp5727366p5727381.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list