Add CLAP plugin destroying

Everything else is still a stub, but at least the lifecycle now works
correctly.
This commit is contained in:
Robbert van der Helm
2022-09-09 15:32:19 +02:00
parent 54dd4c583f
commit d2fb84e529
6 changed files with 51 additions and 14 deletions
+10 -4
View File
@@ -38,16 +38,22 @@ bool ClapLogger::log_request(bool is_host_plugin,
});
}
bool ClapLogger::log_request(bool is_host_plugin,
const clap::plugin::Destroy& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.instance_id << ": clap_plugin::destroy()";
});
}
bool ClapLogger::log_request(bool is_host_plugin, const WantsConfiguration&) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << "Requesting <Configuration>";
});
}
// void ClapLogger::log_response(bool is_host_plugin, const Ack&) {
// log_response_base(is_host_plugin, [&](auto& message) { message << "ACK";
// });
// }
void ClapLogger::log_response(bool is_host_plugin, const Ack&) {
log_response_base(is_host_plugin, [&](auto& message) { message << "ACK"; });
}
void ClapLogger::log_response(
bool is_host_plugin,
+2 -1
View File
@@ -47,6 +47,7 @@ class ClapLogger {
bool log_request(bool is_host_plugin, const clap::plugin_factory::List&);
bool log_request(bool is_host_plugin, const clap::plugin_factory::Create&);
bool log_request(bool is_host_plugin, const clap::plugin::Destroy&);
// TODO: Audio thread requests
// bool log_request(bool is_host_plugin,
@@ -54,7 +55,7 @@ class ClapLogger {
bool log_request(bool is_host_plugin, const WantsConfiguration&);
// void log_response(bool is_host_plugin, const Ack&);
void log_response(bool is_host_plugin, const Ack&);
void log_response(bool is_host_plugin,
const clap::plugin_factory::ListResponse&);
void log_response(bool is_host_plugin,
+2 -1
View File
@@ -41,7 +41,8 @@
// serialize this without it.
using ClapMainThreadControlRequest = std::variant<WantsConfiguration,
clap::plugin_factory::List,
clap::plugin_factory::Create>;
clap::plugin_factory::Create,
clap::plugin::Destroy>;
template <typename S>
void serialize(S& s, ClapMainThreadControlRequest& payload) {
+17
View File
@@ -24,6 +24,7 @@
#include <clap/plugin.h>
#include "../../bitsery/ext/in-place-optional.h"
#include "../common.h"
// Serialization messages for `clap/plugin.h`
@@ -104,6 +105,22 @@ struct Descriptor {
mutable clap_plugin_descriptor_t clap_descriptor;
};
/**
* Message struct for `clap_plugin::destroy()`. The Wine plugin host should
* clean up the plugin, and everything is also cleaned up on the plugin side
* after receiving acknowledgement
*/
struct Destroy {
using Response = Ack;
native_size_t instance_id;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
}
};
} // namespace plugin
} // namespace clap