michaeltyson / TPCircularBuffer

A simple, fast circular buffer implementation
http://atastypixel.com/blog/a-simple-fast-circular-buffer-implementation-for-audio-processing/
847 stars 140 forks source link

Removed dependency from mach #39

Closed TheStarkster closed 7 months ago

TheStarkster commented 7 months ago

I faced problem while using it for android, so found out mach.h is only macOS / iOS, so i removed the dependency from mach.h and made it support both android/iOS/linux/macOS (also its tested already)

michaeltyson commented 7 months ago

Thank you for taking a crack at this!

TPCircularBuffer operates using a VM trick that mirrors the buffer, so that you can write past the end, and it will wrap around to the beginning because of the mirrored copy at the end. I don't see any equivalent implementation here in the Mach replacement - it looks to me like it's simply allocating a single stretch of memory, which means that this will crash (or write past the buffer) as soon as the buffer reaches the wrap point. Have I missed something?