here is how I did it:
[DllImport (dll)]
private static extern IntPtr getAudioBuffer( IntPtr synth);
then to use it:
private float[] buffer = new float[1024];
void OnAudioFilterRead (float[] data, int channels)
{
IntPtr buf = getAudioBuffer();
Marshal.Copy(buf, buffer, 0, buffer.Length);
int i, j;
for ( i = 0, j=0; j < buffer.Length; i = i + channels, j++)
{
data[i] = buffer[j];
if (channels ==2)
{ data [i + 1] = data [i]; }
}
}
Any hint on how to do it more efficiently would be welcome.