commit 00a589fa8b02728b3dc4533325c0d03dc32f53c4
parent ae2e9845baf53205ee33de73e8ee35702d02f54d
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Sat, 24 Apr 2021 01:09:10 +0200
Added draft for ev-loop and idle; ev-loop is necessary on linux
Diffstat:
2 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/include/clap/ext/draft/ev-loop.h b/include/clap/ext/draft/ev-loop.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../../clap.h"
+
+#define CLAP_EXT_POLL "clap/draft/ev-loop"
+
+enum {
+ CLAP_EV_LOOP_READ = 1,
+ CLAP_EV_LOOP_WRITE = 2,
+};
+
+typedef void (*clap_fd_callback)(struct clap_plugin *plugin, int fd, int flags);
+
+typedef void (*clap_timer_callback)(struct clap_plugin *plugin,
+ uint64_t timer_id);
+
+struct clap_host_ev_loop {
+ // [main-thread]
+ bool (*register_timer)(struct clap_host * host,
+ struct clap_plugin *plugin,
+ int64_t period_ms,
+ clap_timer_callback callback,
+ uint64_t * timer_id);
+
+ // [main-thread]
+ bool (*unregister_timer)(struct clap_host * host,
+ struct clap_plugin *plugin,
+ uint64_t * timer_id);
+
+ // [main-thread]
+ bool (*register_fd)(struct clap_host * host,
+ struct clap_plugin *plugin,
+ int fd,
+ int flags,
+ clap_fd_callback callback);
+
+ // [main-thread]
+ bool (*unregister_fd)(struct clap_host * host,
+ struct clap_plugin *plugin,
+ int fd);
+};
+
+#ifdef __cplusplus
+}
+#endif
+\ No newline at end of file
diff --git a/include/clap/ext/draft/idle.h b/include/clap/ext/draft/idle.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../../clap.h"
+
+#define CLAP_EXT_IDLE "clap/draft/idle"
+
+struct clap_plugin_idle {
+ // IDLE time that can be used by the plugin on the main thread
+ // [main-thread]
+ void (*idle)(struct clap_plugin *plugin);
+};
+
+#ifdef __cplusplus
+}
+#endif
+\ No newline at end of file