EDIT: C++ bits removed to avoid confusion
I have an array of data like so
int numSamples = 16;
float *lData = (float*)calloc(numSamples, sizeof(float));
...and I would like to pass this data into a function with a definition like this . . .
void processSampleBlock (const float ** inputChannelData,
int numInputChannels,
...)
As you can see, this function accepts a 2D array, that can have multiple channels. My data is only a single channel (1D), but I can get the code to compile fine by doing a cast like this . .
processSampleBlock ((const float**)(lData),
1,
...)
However, I get a bad access error at runtime then code within the function block attempts to dereference the data within the function . .
for (int nn=0; nn< numSamples; ++nn)
{
float x = inputChannelData[0][nn]; //--> Computer says no
}
I am useless with C style multi-dimensional arrays and am probably making a fundamental error here. Any help would be great! Thanks
boost::scoped_array<float>- Why is this tagged C?