commit 8f3ac8d632e93e96f6665d0cc1574bf134f42307
parent ed7de4967af46afb3c3ef8802a3d4686d267d415
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Fri, 16 Jul 2021 15:50:07 +0200
Some improvements to the interface
Diffstat:
6 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/include/clap/clap.h b/include/clap/clap.h
@@ -110,10 +110,10 @@ typedef struct clap_host {
// [thread-safe]
const void *(*extension)(const struct clap_host *host, const char *extension_id);
- // Ask the host to deactivate and then reactivate the plugin.
+ // Request the host to deactivate and then reactivate the plugin.
// The operation may be delayed by the host.
// [thread-safe]
- void (*restart)(const struct clap_host *host);
+ void (*request_restart)(const struct clap_host *host);
// Request the host to activate and start processing the plugin.
// This is useful if you have external IO and need to wake up the plugin from "sleep".
diff --git a/include/clap/ext/audio-ports.h b/include/clap/ext/audio-ports.h
@@ -12,8 +12,10 @@
///
/// If the plugin does not implement this extension, it will have a stereo input and output.
///
+/// The plugin is only allowed to change its ports configuration while it is deactivated.
+///
/// During @ref clap_plugin.init, the plugin may query @ref clap_host_track_info and select a
-/// configuration adapted to the track it belongs to.
+/// configuration adapted to the track.
///
/// After the plugin initialization, the host may scan the list of configurations and eventually
/// select one that fits the plugin context. The host can only select a configuration if the plugin
@@ -23,8 +25,7 @@
/// - it describes the main input and output ports
/// - it has a name that can be displayed to the user
///
-/// It is very easy for the host to offer a list of possible configurations and let the user choose
-/// one.
+/// The idea behind the configurations, is to let the user choose one via a menu.
///
/// Plugin with very complex configuration possibilities should let the user configure the ports
/// from the plugin GUI, and call @ref clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_ALL).
@@ -92,8 +93,10 @@ typedef struct clap_plugin_audio_ports {
} clap_plugin_audio_ports;
enum {
- // The ports have changed, the host shall deactivate the plugin
- // and perform a full scan of the ports.
+ // The ports have changed, the host shall perform a full scan of the ports.
+ // This flag can only be used if the plugin is not active.
+ // If the plugin active, call host->request_restart() and then call rescan()
+ // when the host calls deactivate()
CLAP_AUDIO_PORTS_RESCAN_ALL = 1 << 0,
// The ports name did change, the host can scan them right away.
diff --git a/include/clap/ext/event-loop.h b/include/clap/ext/event-loop.h
@@ -28,6 +28,11 @@ typedef struct clap_plugin_event_loop {
// [main-thread]
void (*on_timer)(const clap_plugin *plugin, clap_id timer_id);
+ // This callback is "level-triggered".
+ // It means that a writable fd will continuously produce "on_fd()" events;
+ // don't forget using modify_fd() to remove the write notification once you're
+ // done writting.
+ //
// [main-thread]
void (*on_fd)(const clap_plugin *plugin, clap_fd fd, clap_fd_flags flags);
} clap_plugin_event_loop;
diff --git a/include/clap/ext/gui.h b/include/clap/ext/gui.h
@@ -9,13 +9,22 @@ extern "C" {
#endif
typedef struct clap_plugin_gui {
- // Get the size of the plugin UI.
+ // Set the GUI scaling factor.
+ // [main-thread]
+ void (*set_scale)(const clap_plugin *plugin, double scale);
+
+ // Get the size of the plugin UI, with the scaling applied.
// [main-thread]
void (*size)(const clap_plugin *plugin, int32_t *width, int32_t *height);
- // Set the GUI scaling factor.
// [main-thread]
- void (*set_scale)(const clap_plugin *plugin, double scale);
+ bool (*can_resize)(const clap_plugin *plugin);
+
+ // If the plugin gui is resizable, then the plugin will return the closest size
+ // to the given arguments.
+ //
+ // [main-thread]
+ void (*round_size)(const clap_plugin *plugin, int32_t *width, int32_t *height);
// [main-thread]
void (*show)(const clap_plugin *plugin);
diff --git a/include/clap/ext/latency.h b/include/clap/ext/latency.h
@@ -18,9 +18,10 @@ typedef struct clap_plugin_latency {
typedef struct clap_host_latency {
// Tell the host that the latency changed.
- // The new latency will be effective after deactivation of the plugin.
+ // The latency is only allowed to change if the plugin is deactivated.
+ // If the plugin is activated, call host->request_restart()
// [main-thread]
- void (*changed)(const clap_host *host, uint32_t new_latency);
+ void (*changed)(const clap_host *host);
} clap_host_latency;
#ifdef __cplusplus
diff --git a/include/clap/version.h b/include/clap/version.h
@@ -22,7 +22,7 @@ typedef struct clap_version {
}
#endif
-static CLAP_CONSTEXPR const clap_version CLAP_VERSION = {0, 8, 0};
+static CLAP_CONSTEXPR const clap_version CLAP_VERSION = {0, 9, 0};
static CLAP_CONSTEXPR inline bool clap_version_is_compatible(const clap_version &v) {
// For version 0, we require the same minor version because