commit 88d860e4e55567e3b2704b3d173d7d295f999c40
parent ef785b6dd73f44521ae8e1a0e4044bf4e3124f89
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Wed, 21 Apr 2021 21:59:13 +0200
the state ext now uses a stream approach
Diffstat:
1 file changed, 19 insertions(+), 25 deletions(-)
diff --git a/include/clap/ext/state.h b/include/clap/ext/state.h
@@ -1,36 +1,30 @@
-#ifndef CLAP_EXT_STATE_H
-# define CLAP_EXT_STATE_H
+#pragma once
-# include "../clap.h"
+#include "../clap.h"
+#include "stream.h"
-# define CLAP_EXT_STATE "clap/state"
+#define CLAP_EXT_STATE "clap/state"
-# ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
-# endif
+#endif
-struct clap_plugin_state
-{
- /* The plugin has to allocate and save its state into *buffer.
- * The plugin is also responsible to free the buffer on the
- * next call to save() or when the plugin is destroyed.
- * [audio-thread] */
- bool (*save)(struct clap_plugin *plugin, void **buffer, int32_t *size);
+struct clap_plugin_state {
+ /* Saves the plugin state into stream.
+ * [main-thread] */
+ bool (*save)(struct clap_plugin *plugin, struct clap_ostream *stream);
- /* [audio-thread] */
- bool (*restore)(struct clap_plugin *plugin, const void *buffer, int32_t size);
+ /* Loads the plugin state from stream.
+ * [main-thread] */
+ bool (*restore)(struct clap_plugin *plugin, struct clap_istream *stream);
};
-struct clap_host_state
-{
- /* Tell the host that the plugin state has changed.
- * [thread-safe] */
- void (*set_dirty)(struct clap_host *host,
- struct clap_plugin *plugin);
+struct clap_host_state {
+ /* Tell the host that the plugin state has changed.
+ * [thread-safe] */
+ void (*set_dirty)(struct clap_host *host, struct clap_plugin *plugin);
};
-# ifdef __cplusplus
+#ifdef __cplusplus
}
-# endif
-
-#endif /* !CLAP_EXT_STATE_H */
+#endif