I’ve recently made some updates to TPCircularBuffer (on GitHub), my C circular/ring buffer implementation, which add a memory barrier on read and write, inline the main functions for a potential performance boost, and add support for use within C++ projects.
If you’re using TPCircularBuffer at all, I recommend updating!
Related posts
- A simple, fast circular buffer implementation for audio processing Circular buffers are pretty much what they sound like –...
- Circular (ring) buffer plus neat virtual memory mapping trick I’ve just updated my C circular buffer implementation, adopting the...
- Avoid the clobber: Nest your network activity indicator updates On the iPhone, when you are doing anything that uses...
- Avoiding duplicate symbol issues when using common utilities within a static library I’m working on two projects right now that have static...




4 Comments
You might want to consider using NS_INLINE rather than
static inline'. My experience is that the former, probably due to the "always_inline" attribute *does* inline my C++ header code, whereas barestatic inline’ doesn’t:Ah, thanks very much for the suggestion, Jean-François! I’ll try it out.
Hi Michael,
Thanks for this wonderful implementation.
I have seen TPCircularBuffer working absolutely fine in AudioGraph’s sample project, but when I add the .h and .c files of TPCircularBuffer to my project, and import the .h file in my RealTimeAudioController.mm, it gives me the ‘Apple Mach-o-linker error’ saying :
Undefined symbols for architecture armv7: “__Z20TPCircularBufferInitP22TPCircularBufferRecordi”, referenced from: -[RealtimeAudioController initDelayBuffer] in RealtimeAudioController.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have checked and all the required frameworks are added. No idea why that’s happening.
Any help in this regard will be highly appreciated.
Thanks.
In case somebody else is having the same problem as me, here is the solution that worked for me,
When you import the header, instead of writing, import TPCircularBuffer.h
Just write the following, extern “C” { include “TPCircularBuffer.h” };