I have been attempting to pass and array to a method within DiracLE audio library.
The array looks like this in the debugger
- (OSStatus) readFloatsConsecutive:(SInt64)numFrames intoArray:(float**)audio withOffset:(long)offset
That fills the array up like so
if (audio) {
for (long c = 0; c < mExtAFNumChannels; c++) {
if (!audio[c]) continue; // this executes for both channels
// but doesnt proceed into next for loop
for (long v = 0; v < numFrames; v++) {
if (v < loadedPackets) audio[c][v+offset] = (float)data[v*mExtAFNumChannels+c] / 32768.f;
else audio[c][v+offset] = 0.f;
}
}
}
I call it like this
[reader readFloatsConsecutive:frameCount intoArray:arrayToFill];
arrayToFill being an argument to the current function scope
[self readAudioDataForFile:temp withArray:tempArray];
The array was initially passed into the function like this
// this array was passed into the function as tempArray which is float **tempArray = NULL;
arrayToFill = (float **) malloc ( (frameCount * channelCount) * sizeof( float ));
As I needed to extract audio data from the file in my method I have to malloc the array there and pass it into the dirac function for filling. I malloc like so arrayToFill = (float **) malloc ( (frameCount * channelCount) * sizeof( float ));
and then pass it to the dirac function as mentioned before.
This array could be a 2 dimensional or 1 dimensional array depending on channel count