free-audio / clap

Audio Plugin API
https://cleveraudio.org/
MIT License
1.77k stars 100 forks source link

Race condition in the documented workflow for sending automation events from a plugin's UI #124

Closed robbert-vdh closed 2 years ago

robbert-vdh commented 2 years ago

The example workflow for sending automation from a plugin's UI to the host mentions requesting a flush only if the plugin is not processing audio. This can result in a race condition if the host is currently calling stop_processing(). This should instead recommend always calling request_flush(), even if the plugin is currently processing audio. In that case the operation will simply be a no-op.

https://github.com/free-audio/clap/blob/55ee06f776669b94d63247a9c1dcb7dfa6056587/include/clap/ext/params.h#L54-L55

abique commented 2 years ago

Yes, this is true. I'll change it today.