This code should be fast enough to run while recording is happening. I’m doing much more work than this (sample conversion and writing to a file) during recording and it keeps up just fine with plenty of room to spare.
You might look at how many buffers you are using and that those buffers are setup correctly (i.e., they are properly added to the queues.) For example, if you’re running with just one buffer then this code will not start executing until that buffer is full, which means any time you spend performing this work will cause data loss because the audio queues will have nowhere to place incoming data while you work on the one-and-only buffer.
In my app, I set my record buffers to contain 1000ms worth of audio (calculated based on the sample rate, channel count, bits per sample) and I create three buffers. Theoretically, you should only need two buffers, but I prefer to play it safe.
---
To: email@hidden
Subject: Manipulating PCM in Audio Queue Callback
I'm trying to do some expensive PCM processing in "think" Audio Queue's would be the answer since it's not real-time. Well here is what I'm doing: