clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 9b395a69fe73b5d967acc84b71f7ae5104046641
parent 2dcb757d9292981c2ae6dbc6c6c823c5299d0f33
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Sun,  2 May 2021 09:30:37 +0200

Went back on last descision, use int32_t for ids, and address objects using id.

This makes the code more robust when the list is re-ordonated and the param index changes.

Diffstat:
Minclude/clap/events.h | 2+-
Minclude/clap/ext/audio-ports.h | 16++++++++--------
Minclude/clap/ext/draft/remote-controls.h | 6+++---
Minclude/clap/ext/draft/track-info.h | 2+-
Minclude/clap/ext/draft/vst2-convert.h | 4++--
Minclude/clap/ext/draft/vst3-convert.h | 4++--
Minclude/clap/ext/params.h | 20++++++++++----------
Minclude/clap/string-sizes.h | 1-
8 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/include/clap/events.h b/include/clap/events.h @@ -61,7 +61,7 @@ typedef union clap_param_value { typedef struct clap_event_param { int32_t key; int32_t channel; - uint32_t index; // parameter index + uint32_t param_id; // parameter index clap_param_value normalized_value; double normalized_ramp; // valid until the end of the block or the next event } clap_event_param; diff --git a/include/clap/ext/audio-ports.h b/include/clap/ext/audio-ports.h @@ -10,14 +10,14 @@ extern "C" { #define CLAP_EXT_AUDIO_PORTS "clap/audio-ports" typedef struct clap_audio_port_info { - char id[CLAP_ID_SIZE]; // stable identifier - char name[CLAP_NAME_SIZE]; // displayable name, i18n? - bool is_main; // there can only be 1 main input and output - bool is_cv; // control voltage - bool supports_64_bits; // 32 bit support is mandatory, the host chooses - // between 32 and 64. - bool supports_in_place; // if true the daw can use the same buffer for input - // and output, only for main input to main output + int32_t id; // stable identifier + char name[CLAP_NAME_SIZE]; // displayable name, i18n? + bool is_main; // there can only be 1 main input and output + bool is_cv; // control voltage + bool supports_64_bits; // 32 bit support is mandatory, the host chooses + // between 32 and 64. + bool supports_in_place; // if true the daw can use the same buffer for input + // and output, only for main input to main output int32_t channel_count; clap_chmap channel_map; } clap_audio_port_info; diff --git a/include/clap/ext/draft/remote-controls.h b/include/clap/ext/draft/remote-controls.h @@ -10,9 +10,9 @@ extern "C" { #define CLAP_EXT_REMOTE_CONTROLS "clap/draft/remote-controls" typedef struct clap_remote_controls_page { - char id[CLAP_ID_SIZE]; + int32_t id; char name[CLAP_NAME_SIZE]; - int32_t param_id[8][CLAP_ID_SIZE]; + int32_t param_id[8]; } clap_remote_controls_page; typedef struct clap_plugin_remote_controls { @@ -22,7 +22,7 @@ typedef struct clap_plugin_remote_controls { bool (*get_page)(clap_plugin *plugin, int32_t page_index, clap_remote_controls_page *page); // [main-thread] - void (*select_page)(clap_plugin *plugin, int32_t page_index); + void (*select_page)(clap_plugin *plugin, int32_t page_id); } clap_host_plugin_info; typedef struct clap_host_remote_controls { diff --git a/include/clap/ext/draft/track-info.h b/include/clap/ext/draft/track-info.h @@ -11,7 +11,7 @@ extern "C" { #define CLAP_EXT_TRACK_INFO "clap/draft/track-info" typedef struct clap_track_info { - char id[CLAP_ID_SIZE]; + int32_t id; int32_t index; char name[CLAP_NAME_SIZE]; char path[512]; // Like "/group1/group2/drum-machine/drum-pad" diff --git a/include/clap/ext/draft/vst2-convert.h b/include/clap/ext/draft/vst2-convert.h @@ -28,7 +28,7 @@ typedef struct clap_plugin_vst2_convert { bool (*convert_normalize_value)(clap_plugin * plugin, uint32_t vst2_param_id, double vst2_normalized_value, - char * clap_param_id, + int32_t * clap_param_id, clap_param_value *clap_normalized_value); // converts the vst2 param id and plain value to clap param id and @@ -37,7 +37,7 @@ typedef struct clap_plugin_vst2_convert { bool (*convert_plain_value)(clap_plugin * plugin, uint32_t vst2_param_id, double vst2_plain_value, - char * clap_param_id, + int32_t * clap_param_id, clap_param_value *clap_plain_value); } clap_plugin_vst2_convert; diff --git a/include/clap/ext/draft/vst3-convert.h b/include/clap/ext/draft/vst3-convert.h @@ -25,7 +25,7 @@ typedef struct clap_plugin_vst3_convert { bool (*convert_normalize_value)(clap_plugin * plugin, uint32_t vst3_param_id, double vst3_normalized_value, - char * clap_param_id, + int32_t * clap_param_id, clap_param_value *clap_normalized_value); // converts the vst3 param id and plain value to clap param id and @@ -34,7 +34,7 @@ typedef struct clap_plugin_vst3_convert { bool (*convert_plain_value)(clap_plugin * plugin, uint32_t vst3_param_id, double vst3_plain_value, - char * clap_param_id, + int32_t * clap_param_id, clap_param_value *clap_plain_value); } clap_plugin_vst3_convert; diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h @@ -19,7 +19,7 @@ typedef enum clap_param_type { typedef struct clap_param_info { /* param info */ int32_t index; - char id[CLAP_ID_SIZE]; + int32_t id; char name[CLAP_NAME_SIZE]; // the display name char module[CLAP_MODULE_SIZE]; // the module containing the param, eg: // "/filters/moog"; '/' will be used as a @@ -53,7 +53,7 @@ typedef struct clap_plugin_params { bool (*get_info)(clap_plugin *plugin, int32_t param_index, clap_param_info *param_info); bool (*get_enum_value)(clap_plugin * plugin, - int32_t param_index, + int32_t param_id, int32_t value_index, clap_param_value *plain_value); @@ -66,35 +66,35 @@ typedef struct clap_plugin_params { // in the next process call to update the audio processor. // [main-thread] void (*set_value)(clap_plugin * plugin, - int32_t param_index, + int32_t param_id, clap_param_value plain_value, clap_param_value plain_modulated_value); // Normalization only exists for float values // [thread-safe,lock-wait-free] - double (*plain_to_norm)(clap_plugin *plugin, int32_t param_index, double plain_value); - double (*norm_to_plain)(clap_plugin *plugin, int32_t param_index, double normalized_value); + double (*plain_to_norm)(clap_plugin *plugin, int32_t param_id, double plain_value); + double (*norm_to_plain)(clap_plugin *plugin, int32_t param_id, double normalized_value); // Formats the display text for the given parameter value. // [thread-safe,lock-wait-free] bool (*value_to_text)(clap_plugin * plugin, - int32_t param_index, + int32_t param_id, clap_param_value plain_value, char * display, uint32_t size); bool (*text_to_value)(clap_plugin * plugin, - int32_t param_index, + int32_t param_id, const char * display, clap_param_value *plain_value); } clap_plugin_params; typedef struct clap_host_params { /* [main-thread] */ - void (*touch_begin)(clap_host *host, clap_plugin *plugin, int32_t index); + void (*touch_begin)(clap_host *host, clap_plugin *plugin, int32_t param_id); /* [main-thread] */ - void (*touch_end)(clap_host *host, clap_plugin *plugin, int32_t index); + void (*touch_end)(clap_host *host, clap_plugin *plugin, int32_t param_id); // If the plugin is activated, the host must send a parameter update // in the next process call to update the audio processor. @@ -102,7 +102,7 @@ typedef struct clap_host_params { // [main-thread] void (*changed)(clap_host * host, clap_plugin * plugin, - int32_t index, + int32_t param_id, clap_param_value plain_value); // [main-thread] diff --git a/include/clap/string-sizes.h b/include/clap/string-sizes.h @@ -7,7 +7,6 @@ extern "C" { #endif typedef enum clap_string_size { - CLAP_ID_SIZE = 64, CLAP_NAME_SIZE = 64, CLAP_MODULE_SIZE = 128, } clap_string_size;