-
Notifications
You must be signed in to change notification settings - Fork 22
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
Q: Is forge_midimessage()
thread-safe?
#37
Comments
All plugin processing, this must be called in the realtime-context of the host. Custom threads in plugins are highly problematic and to be avoided
If you really need to do work in the background, https://lv2plug.in/ns/ext/worker might help. There are very very few plugins that use threads.
Nope. Same rules apply, besides Lua DSP scripts cannot even start threads. |
See also https://lv2plug.in/c/html/group__lv2core.html#a4d904937a1bd27cb5f5478f95c708b16 Notably:
hence you can only call Also read the "Threading Rulers" at http://lv2plug.in/ns/lv2core Similar rules apply to all plugin standards. |
Thanks for the clarifications. They are much appreciated! The original goal was to implement a generic MIDI cross-talk cancellation algorithm mostly intended for MIDI drum triggers. I already tried mididings, but that didn't perform well enough; now LV2 plugins apparently aren't fast enough for MIDI either (without doing rather uncommon things as you pointed out)... I guess I might try to implement my own simple MIDI router with |
How can plugins not be fast enough? They run every process cycle. |
On 10/27/23 14:53, Robin Gareus wrote:
How can plugins not be fast enough? They run every process cycle.
I pointed out that you cannot use threads, which is entirely unrelated.
Yes, "not fast enough" only applies to mididings and "not easily usable for blocking tasks" to LV2 plugins. My brain mixed it up, sorry.
At least rtmidi seems to work with both speed & easy parallel execution according to my tests so far.
|
For anyone needing similar code - I ended up with this: https://github.com/3hhh/xtalk |
I tried to call forge_midimessage() from a Linux background pthread, but noticed no effect / the Midi notes never reached Ardour.
I confirmed that the thread was running, receiving & processing the Midi notes from the foreground thread.
So is
forge_midimessage()
possibly not thread-safe?If not, can the Ardour lua plugins create Midi messages from background threads instead?
If I understand it correctly, I could also use the Midi timestamps sent by the Midi master for timing, but that doesn't suit my needs as these only come in every 10ms or so, which is above the resolution (1-5ms) I need. So I tried background threading.
The text was updated successfully, but these errors were encountered: