Implement the clap_{input,output}_events_t vtables

Now we can use `EventList` to pass events between the host and the
plugin.
This commit is contained in:
Robbert van der Helm
2022-10-01 16:51:00 +02:00
parent 5d3590c8a8
commit f782aa4787
2 changed files with 72 additions and 0 deletions
+24
View File
@@ -307,6 +307,26 @@ class EventList {
*/
void write_back_outputs(const clap_output_events_t& out_events) const;
/**
* Get a `clap_input_events_t` interface for this event list that the plugin
* can read the events from. This is only valid as long as this object is
* not moved.
*/
const clap_input_events_t* input_events();
/**
* Get a `clap_output_events_t` interface for this event list that the
* plugin can push events to. This is only valid as long as this object is
* not moved.
*/
const clap_output_events_t* output_events();
static uint32_t CLAP_ABI in_size(const struct clap_input_events* list);
static const clap_event_header_t* CLAP_ABI
in_get(const struct clap_input_events* list, uint32_t index);
static bool CLAP_ABI out_try_push(const struct clap_output_events* list,
const clap_event_header_t* event);
/**
* Return the number of events we store. Used in debug logs.
*/
@@ -319,6 +339,10 @@ class EventList {
private:
llvm::SmallVector<Event, 64> events_;
// These are populated in the `input_events()` and `output_events()` methods
clap_input_events_t input_events_vtable_{};
clap_output_events_t output_events_vtable_{};
};
} // namespace events