commit 1c2f9406b253b29a88bb0152cd86697169cca97a
parent c960713e9b8430d9b790a7e27ec618356e248478
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Fri, 16 Jul 2021 18:38:22 +0200
Add refresh()
Diffstat:
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/examples/host/plugin-host.cc b/examples/host/plugin-host.cc
@@ -29,7 +29,7 @@ PluginHost::PluginHost(Engine &engine) : QObject(&engine), engine_(engine) {
host_.clap_version = CLAP_VERSION;
host_.extension = PluginHost::clapExtension;
host_.name = "Clap Test Host";
- host_.version = "0.0.1";
+ host_.version = "0.1.0";
host_.vendor = "clap";
host_.url = "https://github.com/free-audio/clap";
diff --git a/examples/plugins/clap-entry.cc b/examples/plugins/clap-entry.cc
@@ -61,11 +61,15 @@ static uint32_t clap_get_invalidation_sources_count(void)
return 0;
}
-static const clap_plugin_invalidation_source *get_invalidation_sources(uint32_t index)
+static const clap_plugin_invalidation_source *clap_get_invalidation_sources(uint32_t index)
{
return nullptr;
}
+static void clap_refresh(void)
+{
+}
+
CLAP_EXPORT const struct clap_plugin_entry clap_plugin_entry = {
CLAP_VERSION,
clap_init,
@@ -74,5 +78,6 @@ CLAP_EXPORT const struct clap_plugin_entry clap_plugin_entry = {
clap_get_plugin_descriptor,
clap_create_plugin,
clap_get_invalidation_sources_count,
- get_invalidation_sources,
+ clap_get_invalidation_sources,
+ clap_refresh,
};
\ No newline at end of file
diff --git a/include/clap/clap.h b/include/clap/clap.h
@@ -220,10 +220,13 @@ typedef struct clap_plugin_invalidation_source {
} clap_plugin_invalidation_source;
// This interface is the entry point of the dynamic library.
+//
// There is an invalidation mechanism for the set of plugins which is based on files.
// The host can watch the plugin DSO's mtime and a set of files's mtime provided by
// get_clap_invalidation_source().
//
+// The set of plugins must not change, except during a call to refresh() by the host.
+//
// Every methods must be thread-safe.
struct clap_plugin_entry {
clap_version clap_version; // initialized to CLAP_VERSION
@@ -254,6 +257,10 @@ struct clap_plugin_entry {
// Get the invalidation source by its index.
// [thread-safe]
const clap_plugin_invalidation_source *(*get_invalidation_sources)(uint32_t index);
+
+ // In case the host detected a invalidation event, it can call refresh() to let the
+ // plugin_entry scan the set of plugins available.
+ void (*refresh)(void);
};
/* Entry point */