
Untitled
By: a guest on
Aug 10th, 2012 | syntax:
None | size: 1.04 KB | hits: 6 | expires: Never
Empty float ** for sound samples
- (OSStatus) readFloatsConsecutive:(SInt64)numFrames intoArray:(float**)audio withOffset:(long)offset
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;
}
}
}
[reader readFloatsConsecutive:frameCount intoArray:arrayToFill];
// this array was passed into the function as tempArray which is float **tempArray = NULL;
arrayToFill = (float **) malloc ( (frameCount * channelCount) * sizeof( float ));
arrayToFill = (float *) malloc ( (frameCount * channelCount) * sizeof( float ));
arrayToFill = (float **)calloc(channelCount, sizeof(float*));
for (int i = 0; i < channelCount; ++i)
arrayToFill[i] = (float*)calloc(frameCount, sizeof(float));