• How to pass array of arrays to an external library?

    From Joe Betz@21:1/5 to All on Thu Oct 20 22:50:07 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)