From c7f9b12ca60a8f65d0d98ee987f6482e6d24f143 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 10 Sep 2022 18:02:19 +0200 Subject: [PATCH] Add clap_plugin msgs for everything except process --- src/common/serialization/clap/plugin.h | 101 ++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) diff --git a/src/common/serialization/clap/plugin.h b/src/common/serialization/clap/plugin.h index 75f209e0..9e07c90c 100644 --- a/src/common/serialization/clap/plugin.h +++ b/src/common/serialization/clap/plugin.h @@ -24,6 +24,7 @@ #include #include "../../bitsery/ext/in-place-optional.h" +#include "../audio-shm.h" #include "../common.h" #include "host.h" @@ -162,7 +163,7 @@ struct Init { /** * 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 + * after receiving acknowledgement. */ struct Destroy { using Response = Ack; @@ -175,6 +176,104 @@ struct Destroy { } }; +/** + * The response to the `clap::plugin::Activate` message defined below. + */ +struct ActivateResponse { + bool result; + /** + * Only set if activating was successful and the config is different from a + * previously returned config. + */ + std::optional updated_audio_buffers_config; + + template + void serialize(S& s) { + s.value1b(result); + s.ext(updated_audio_buffers_config, bitsery::ext::InPlaceOptional{}); + } +}; + +/** + * Message struct for `clap_plugin::activate()`. This is where shared memory + * audio buffers are set up. + */ +struct Activate { + using Response = ActivateResponse; + + native_size_t instance_id; + + double sample_rate; + uint32_t min_frames_count; + uint32_t max_frames_count; + + template + void serialize(S& s) { + s.value8b(instance_id); + s.value8b(sample_rate); + s.value4b(min_frames_count); + s.value4b(max_frames_count); + } +}; + +/** + * Message struct for `clap_plugin::deactivate()`. + */ +struct Deactivate { + using Response = Ack; + + native_size_t instance_id; + + template + void serialize(S& s) { + s.value8b(instance_id); + } +}; + +/** + * Message struct for `clap_plugin::start_processing()`. + */ +struct StartProcessing { + using Response = PrimitiveWrapper; + + native_size_t instance_id; + + template + void serialize(S& s) { + s.value8b(instance_id); + } +}; + +/** + * Message struct for `clap_plugin::stop_processing()`. + */ +struct StopProcessing { + using Response = Ack; + + native_size_t instance_id; + + template + void serialize(S& s) { + s.value8b(instance_id); + } +}; + +/** + * Message struct for `clap_plugin::reset()`. + */ +struct Reset { + using Response = Ack; + + native_size_t instance_id; + + template + void serialize(S& s) { + s.value8b(instance_id); + } +}; + +// TODO: Process + } // namespace plugin } // namespace clap