Hey,
I have written a plugin that generates syx messages from a machine learning model that is controlled by a set of sliders. The model takes about ~20ms each call on my machine and for this reason I want to give the user the option to either run the model in the process_block or in a listener callback. This way users with fast enough computers can have the model run in real time and users with slower computers can still make use of the plugin without it under-running.
Now when I have the model processing in the listener I get an issue where I slide a slider the callback gets called multiple times which means the model is being called multiple times simultaneously which causes lots of slowdowns.
I am wondering if there is a way to limit the maximum number of concurrent callbacks to just one and to have only the most recent callback to continue processing? Or if someone has a some other recommendation of a pattern that could bypass this issue?
Thanks!

