How to pass array of arrays to an external library?

34 views
Skip to first unread message

Joe Betz

unread,
Oct 21, 2022, 1:50:08 AM10/21/22
to
Specifically, I need to pass an array of arrays of floats. It's a buffer to be populated by an external library with audio data.

I've tried:

(PointerArray length: 2 elementClass: FLOATArray)
at: 1 put: (FLOATArray new: 512);
at: 2 put: (FLOATArray new: 512);
yourself.

But this errors with: "FLOATArray class should not implement #fromAddress:". The external method does return, however, but it seems Dolphin has issues recovering the float arrays from the result.

The spec for the C function is:

int fluid_synth_process (
fluid_synth_t * synth,
int len,
int nfx,
float * fx[],
int nout,
float * out[]
)

With the last argument being the tricky bit. I've tried represented it with both float* and float** in the Smalltalk stdcall specification, but neither worked.

More documentation on the C function: https://www.fluidsynth.org/api/group__audio__rendering.html#gaf41e26b153a095dbc4248e9df4f3ad46
Reply all
Reply to author
Forward
0 new messages