I’ve just updated my C circular buffer implementation, adopting the trick originally proposed by Philip Howard and adapted to Darwin by Kurt Revis: A virtual copy of the buffer is inserted directly after the end of the buffer, so that you can write past the end of the buffer, but have your writes automatically wrapped around to the start — no need to manually implement buffer wrapping logic.
This dramatically simplifies the use of a circular buffer — you can use chunks of the buffer without any need to worry about where the wrap point is.
See the new implementation, which is thread-safe with one consumer and one producer, with no need for locks, making it perfect for use with high-priority Core Audio threads, on GitHub: TPCircularBuffer.
There’s a basic example of its use over on the original post.



Presenting TPAudioController, the iOS audio engine library
The library, which is also the engine behind our popular live looper app Loopy, defines protocols for recording, playback, and audio output capture for easy inclusion with existing or new projects.
It’s designed to be really easy to work with, in order to get new audio projects off the ground quickly, and to dramatically cut down the iOS audio learning curve.
Find out more, download an evaluation version of the framework and a complete sample synth app here.