-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use mutexes on the DSP thread #55
Comments
This comment was marked as outdated.
This comment was marked as outdated.
I'll be working on this system over on the |
Thanks a ton for taking this on!
I can help testing, if you want.
Personally, I'd be more than happy to adapt my plugin to any API changes, if that makes it easier for you. |
I appreciate the offer! I'll open a PR when I've made enough progress so that you can test the new system :)
For sure! I'm definitely not against introducing major breaking changes to Cyma, per se. After all, it is still in 0.1.0. But I do however want to only do it when breaking changes would be sensible (e.g. for performance reasons or ease of use.) |
Mutexes are discouraged on the Plugin thread - they can lead to lock-ups, glitches, and general performance issues.
Currently, many of Cyma's visualizers synchronize with audio data through some
Arc<Mutex<impl VisualizerBuffer>>
. The Mutex needs to be locked every time a new chunk of audio gets enqueued or everything gets read out. This can introduce glitches when many plug-ins are used.A better solution would be a data structure that the plugin processor can continuously write to - whenever it feels like it - without any sort of locking or waiting. I think locking or waiting would probably be fine on the editor thread, though it should definitely perform well at good frame rates. The editor also, in the case of circular buffers, always needs to read out the buffer starting at the correct index.
Possible solutions include:
This is going to be a pretty big change. It should be well though-out. Here's a rough outline of what needs to be done:
The text was updated successfully, but these errors were encountered: