Check for pending messages after .process()
This commit is contained in:
parent
f1ede7a2ca
commit
16dc595aa6
@ -308,9 +308,16 @@ struct Plugin : public clap_plugin {
|
||||
}
|
||||
inputBuffers.resize(0);
|
||||
outputBuffers.resize(0);
|
||||
|
||||
if (plugin.effect.hasPendingWebMessage()) {
|
||||
plugin.host->request_callback(plugin.host);
|
||||
}
|
||||
return CLAP_PROCESS_CONTINUE;
|
||||
}
|
||||
static void plugin_on_main_thread(const clap_plugin *obj) {}
|
||||
static void plugin_on_main_thread(const clap_plugin *obj) {
|
||||
auto &plugin = *(Plugin *)obj;
|
||||
plugin.sendWebMessages();
|
||||
}
|
||||
|
||||
// parameters
|
||||
struct Param : public clap_param_info {
|
||||
@ -609,7 +616,7 @@ struct Plugin : public clap_plugin {
|
||||
if (!fillFromStream(stream, buffer)) return false;
|
||||
StateReader storage{buffer};
|
||||
plugin.effect.state(storage);
|
||||
sendWebMessages(); // should already be on the main thread
|
||||
plugin.sendWebMessages(); // should already be on the main thread
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -267,6 +267,11 @@ struct WebUIHelper {
|
||||
readyToSend.test_and_set();
|
||||
}
|
||||
};
|
||||
|
||||
bool hasPendingWebMessage() const {
|
||||
auto &message = queue[readIndex];
|
||||
return message.readyToSend.test();
|
||||
}
|
||||
|
||||
// Poll on the main thread (and directly after any `.webReceive()`), calling `.sent()` after you've sent it, repeat until you get `nullptr`
|
||||
WebMessage * getPendingWebMessage() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user