Ringbuffer vs NBuffer #960
-
What is the difference between RingBuffer and NBuffer in terms of how they handle old data when the buffer is full? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
All buffers are working in the same way, that they can't write any data when the buffer is full. The difference is, that the Ringbuffer allocates 1 array and the NBuffer allocates n arrays: The NBuffer is just a flexible abstraction of e.g. a double buffer (when you define the number of buffers as 2)! If you want to overwrite old data, this is simple: just check if you have enough free space to write and if not, read the amount that you want to be ignored, to free it up. As an exception: the VariableSpeed related buffers however are working a bit different, but this is related to pitch shifting, which is another special topic. |
Beta Was this translation helpful? Give feedback.
All buffers are working in the same way, that they can't write any data when the buffer is full. The difference is, that the Ringbuffer allocates 1 array and the NBuffer allocates n arrays: The NBuffer is just a flexible abstraction of e.g. a double buffer (when you define the number of buffers as 2)!
If you want to overwrite old data, this is simple: just check if you have enough free space to write and if not, read the amount that you want to be ignored, to free it up.
As an exception: the VariableSpeed related buffers however are working a bit different, but this is related to pitch shifting, which is another special topic.