Hi to all,
I have a question that might be simple but unfortunately not for me . I searched the list, but didn't find anything so I decided to post here for the first time.
I made an Audio Unit that processes audioblocks with a fix framesize of 512 samples ( the blocks are passed to a FFT ).
It works fine if the host passes renderbuffers >= 512. To make it work with smaller renderbuffers I tryed to implement a second buffer (a kind FIFO queue), that collects all input-samples up to 512 and than passes this block to feed the FFT.
It also works, but I get very short overloads about every 30 seconds, and that seems really strange to me. To test it, I built a new AudioUnit from the Apple-Template that does just the buffering without further processing (see code below). Even with this simple code the same overloads occur.
Is there something more that has to be considered when working with these kind FIFO queues ?
The code looks like this:
while (inFramesToProcess-- > 0) { prozessBufferIn[pBufferIndex] = *sourceP; sourceP += inNumChannels;
*destP = prozessBufferOut[pBufferIndex]; destP += inNumChannels;
pBufferIndex++; if (pBufferIndex == 512) { // buffer is full and can be processed
pBufferIndex = 0;
// do the buffer processing and after that write the processed buffer to prozessBufferOut
}
}
Thanks.
Bernd |