0

I'm developing an app of recording, but I have a demand that the size of input buffer should be 882 bytes. I know that I can modify the mDataByteSize of buffList like this picture. But it can only be modified to power of 2. When I tried to modify it to 882, it warned me that "AudioUnitRender error:-50".

I hope somebody can help me because I have no way.

Grayson
  • 41
  • 8

1 Answers1

0

You can't demand a specific input size in an Audio Unit recording callback bufferList. In fact, the Audio Unit API is allowed to change the number of samples per audio buffer at run time. So your app has to support a differing number of frames than requested, each callback.

Instead your app should save the samples in another temporary FIFO buffer, and the later remove some of the samples in your desired block size when that temporary FIFO buffer become full enough. Typically a circular buffer is used to store the temporary amount until it gets filled to the size you need or larger. They you can pull out exactly 882 or whatever number of samples you need.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153