I'm wrapping a few calls to the unmanaged Aubio library dll (Aubio.org), and I'm wondering what a good way is to deal with the Aubio samplebuffer.
It's defined like this :
// Buffer for real values
struct _fvec_t {
uint length; // length of buffer
uint channels; // number of channels
float **data; // data array of size [length] * [channels]
};
Aubio creates the struct for me with the datamembers set up correctly, so I get an IntPtr. I need to read/write to the data pointer(s) from my C# code.
for (int chan_idx = 0; chan_idx < my_fvec.channels; ++chan_idx)
for (int i=0; i<something; i++)
my_fvec.data[chan_idx][i] = SomeRandomValue();
What is the correct way to 'map' a C# struct to the fvec_t type so I can access the data member properly to read/write to it ?
(Or should I use Marshal.Copy,and how do I do that with the array-of-pointers ?)