Blog

Some updates to TPCircularBuffer

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

Tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

4 Comments

  1. Jean-François Brouil
    Posted February 14, 2012 at 11:08 pm | Permalink

    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:

        #define NS_INLINE static inline attribute((always_inline))
    

    • Posted February 15, 2012 at 8:29 am | Permalink

      Ah, thanks very much for the suggestion, Jean-François! I’ll try it out.

  2. Shahzeb
    Posted March 14, 2012 at 4:03 pm | Permalink

    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.

    • Shahzeb
      Posted March 14, 2012 at 4:17 pm | Permalink

      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” };

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use Markdown (surround code in `back-ticks`), or these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Subscribe without commenting