I marshalled correctly to:
IntPtr buffer
Buffer is pointer to array of 2 pointers to arrays with respective data. The problem is that I get not accurate data, like if there's something missing in the data retrieved (e.g. missimg samples from stream of audio data).
// length is parameter
IntPtr[] temp = new IntPtr[2];
Marshal.Copy(buffer, temp, 0, 2);
bufferedData = new byte[bufferSize];
byte[] a = new byte[length];
byte[] b = new byte[length];
Marshal.Copy(temp[0], a, 0, length);
Marshal.Copy(temp[1], b, 0, length);
edit: sorry I forgot to write those 2 lines :)