commit c5944cce009e763e8011432a5f1c911a7985e9af
parent 32fcc834d5dae7b24eb6a71fd5fc5e1194b33c2d
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date: Fri, 27 May 2022 11:25:37 +0200
Simplify quick controls
Diffstat:
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/include/clap/ext/draft/quick-controls.h b/include/clap/ext/draft/quick-controls.h
@@ -3,6 +3,10 @@
#include "../../plugin.h"
#include "../../string-sizes.h"
+// This extensions provides a set a pages, where each page contains up to 8 controls.
+// Those controls are param_id, and they are meant to be mapped onto a physical controller.
+// We chose 8 because this what most controllers offers, and it is more or less a standard.
+
static CLAP_CONSTEXPR const char CLAP_EXT_QUICK_CONTROLS[] = "clap.quick-controls.draft/0";
#ifdef __cplusplus
@@ -14,7 +18,6 @@ enum { CLAP_QUICK_CONTROLS_COUNT = 8 };
typedef struct clap_quick_controls_page {
clap_id id;
char name[CLAP_NAME_SIZE];
- char keywords[CLAP_KEYWORDS_SIZE];
clap_id param_ids[CLAP_QUICK_CONTROLS_COUNT];
} clap_quick_controls_page_t;
@@ -24,24 +27,17 @@ typedef struct clap_plugin_quick_controls {
// [main-thread]
bool (*get)(const clap_plugin_t *plugin, uint32_t page_index, clap_quick_controls_page_t *page);
-
- // [main-thread]
- void (*select)(const clap_plugin_t *plugin, clap_id page_id);
-
- // [main-thread]
- clap_id (*get_selected)(const clap_plugin_t *plugin);
} clap_plugin_quick_controls_t;
-enum {
- CLAP_QUICK_CONTROLS_PAGES_CHANGED = 1 << 0,
- CLAP_QUICK_CONTROLS_SELECTED_PAGE_CHANGED = 1 << 1,
-};
-typedef uint32_t clap_quick_controls_changed_flags;
-
typedef struct clap_host_quick_controls {
// Informs the host that the quick controls have changed.
// [main-thread]
- void (*changed)(const clap_host_t *host, clap_quick_controls_changed_flags flags);
+ void (*changed)(const clap_host_t *host);
+
+ // Suggest a page to the host because it correspond to what the user is currently editing in the
+ // plugin's GUI.
+ // [main-thread]
+ void (*suggest_page)(const clap_host_t *host, clap_id page_id);
} clap_host_quick_controls_t;
#ifdef __cplusplus
diff --git a/include/clap/string-sizes.h b/include/clap/string-sizes.h
@@ -7,7 +7,6 @@ extern "C" {
enum {
CLAP_NAME_SIZE = 256,
CLAP_MODULE_SIZE = 512,
- CLAP_KEYWORDS_SIZE = 256,
CLAP_PATH_SIZE = 4096,
};