LMMS / lmms

Cross-platform music production software

Home Page:https://lmms.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RingBuffer Refactor

TechnoPorg opened this issue · comments

Putting this here to act as a reminder to us that it needs to be done.

Enhancement Summary

Ringbuffers are an important data structure for realtime audio processing, and LMMS makes extensive use of them in various places throughout the codebase.
Currently, they are implemented through the ringbuffer submodule, LMMS' own RingBuffer class, which has heavy and unnecessary coupling to the engine, and a LocklessRingBuffer type as well.

It would be good to consolidate all of those into one ring buffer implementation that is fast, flexible, and limited in scope to just being a data structure.

Justification

It will help simplify the codebase and make behaviour more consistent.

We should update the RingBuffer dependency as well

[...] implementation that is fast, flexible, and limited in scope

And realtime-safe. https://gist.github.com/JohannesLorenz/5e1ebb6dd0af5efbff41ead2619210ae

Not sure what's the state of our local RingBuffer, but the LocklessRingBuffer (made by Johannes) was made specifically with that in mind, so I suspect it would be the better candidate to keep.

Searching for references to RingBuffer in the code only yields MultitapEchoEffect as a client of that class. So if that plugin could be switched to use LocklessRingBuffer then the non-realtime safe RingBuffer could be removed completely.

As was already stated LocklessRingBuffer is a wrapper around the underlying ringbuffer submodule. I guess it will add some functionality which is specific to LMMS so that class should be kept.