Original Post
Ok. I'm working on a wrapper for the PortAudio library. I have it working but I have 2 questions/problems.
1. One of the structs that I receive from the unmanaged library as the following fields:
int numSampleRates;
double * sampleRates;
I am having trouble marshalling that because sampleRates is pointer to an array. Does anyone know how I can do it. Also would using an unsafe method with pointer work to get access to the data? I would think it would but is there a better way?
2. PortAudio works by using callbacks. I have a callback that works. Here is an example callback:
// Our Callback
unsafe static int patestCallback(IntPtr inputBuffer,IntPtr outputBuffer,
UInt32 framesPerBuffer,double outTime,Object userData)
{
TestData data = userData as TestData;
float * oBuf = (float*)outputBuffer.ToPointer();
UInt32 i;
int finished = 0;
for( i=0; i= TABLE_SIZE) data.left_phase -= TABLE_SIZE;
data.right_phase += 3; //higher pitch so we can distinguish left and right.
if(data.right_phase >= TABLE_SIZE ) data.right_phase -= TABLE_SIZE;
}
return finished;
}
Is there anyway I could avoid using pointers for that? Thanks
[edited by - cilcoder on November 25, 2003 12:18:58 AM]