Implement CLAP callback requests

This commit is contained in:
Robbert van der Helm
2022-09-11 18:40:46 +02:00
parent 7151544f99
commit 5d31191806
5 changed files with 54 additions and 21 deletions
@@ -16,6 +16,8 @@
#pragma once
#include <atomic>
#include <clap/host.h>
#include "../../common/serialization/clap/plugin-factory.h"
@@ -78,4 +80,12 @@ class clap_host_proxy {
* the start of the struct and directly casting the `clap_host_t*`.
*/
const clap_host_t host_vtable_;
/**
* Keeps track of whether there are pending host callbacks. Used to prevent
* calling `clap_plugin::on_main_thread()` multiple times in a row when the
* plugin calls `clap_host::request_callback()` multiple times before
* `clap_plugin::on_main_thread()` is called.
*/
std::atomic_bool has_pending_host_callbacks_ = false;
};