clap

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

commit 2dcb757d9292981c2ae6dbc6c6c823c5299d0f33
parent 14c6e63e903892308bf77788aebde1f72c8c5517
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Sat,  1 May 2021 23:40:22 +0200

Use strings for ids, that will remove the confusion between param id and index

Diffstat:
M.clang-format | 2+-
Minclude/clap/ext/audio-ports.h | 22+++++++++++-----------
Minclude/clap/ext/draft/remote-controls.h | 4++--
Minclude/clap/ext/draft/track-info.h | 6+++---
Minclude/clap/ext/draft/vst2-convert.h | 12++++++------
Minclude/clap/ext/draft/vst3-convert.h | 12++++++------
Minclude/clap/ext/params.h | 10+++++-----
Minclude/clap/string-sizes.h | 3++-
8 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/.clang-format b/.clang-format @@ -105,7 +105,7 @@ PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Right ReflowComments: true -SortIncludes: true +SortIncludes: false SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false diff --git a/include/clap/ext/audio-ports.h b/include/clap/ext/audio-ports.h @@ -1,23 +1,23 @@ #pragma once +#include "../clap.h" +#include "../channel-map.h" + #ifdef __cplusplus extern "C" { #endif -#include "../clap.h" -#include "../channel-map.h" - #define CLAP_EXT_AUDIO_PORTS "clap/audio-ports" typedef struct clap_audio_port_info { - uint32_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 + 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 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 { - int32_t id; + char id[CLAP_ID_SIZE]; char name[CLAP_NAME_SIZE]; - int32_t param_id[8]; + int32_t param_id[8][CLAP_ID_SIZE]; } clap_remote_controls_page; typedef struct clap_plugin_remote_controls { diff --git a/include/clap/ext/draft/track-info.h b/include/clap/ext/draft/track-info.h @@ -1,7 +1,7 @@ #pragma once -#include "../../channel-map.h" #include "../../clap.h" +#include "../../channel-map.h" #include "../../color.h" #ifdef __cplusplus @@ -11,9 +11,9 @@ extern "C" { #define CLAP_EXT_TRACK_INFO "clap/draft/track-info" typedef struct clap_track_info { - uint32_t id; + char id[CLAP_ID_SIZE]; + int32_t index; char name[CLAP_NAME_SIZE]; - int32_t track_index; char path[512]; // Like "/group1/group2/drum-machine/drum-pad" int32_t channel_count; clap_chmap channel_map; diff --git a/include/clap/ext/draft/vst2-convert.h b/include/clap/ext/draft/vst2-convert.h @@ -1,12 +1,12 @@ #pragma once +#include "../../clap.h" +#include "../../stream.h" + #ifdef __cplusplus extern "C" { #endif -#include "../../clap.h" -#include "../../stream.h" - #define CLAP_EXT_VST2_CONVERT "clap/draft/vst2-convert" typedef struct clap_plugin_vst2_convert { @@ -28,16 +28,16 @@ typedef struct clap_plugin_vst2_convert { bool (*convert_normalize_value)(clap_plugin * plugin, uint32_t vst2_param_id, double vst2_normalized_value, - uint32_t * clap_param_id, + char * clap_param_id, clap_param_value *clap_normalized_value); // converts the vst2 param id and plain value to clap param id and // plain value. // [thread-safe] bool (*convert_plain_value)(clap_plugin * plugin, - uint32_t vst2_param_index, + uint32_t vst2_param_id, double vst2_plain_value, - uint32_t * clap_param_index, + char * 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 @@ -1,12 +1,12 @@ #pragma once +#include "../../clap.h" +#include "../../stream.h" + #ifdef __cplusplus extern "C" { #endif -#include "../../clap.h" -#include "../../stream.h" - #define CLAP_EXT_VST3_CONVERT "clap/draft/vst3-convert" typedef struct clap_plugin_vst3_convert { @@ -25,16 +25,16 @@ typedef struct clap_plugin_vst3_convert { bool (*convert_normalize_value)(clap_plugin * plugin, uint32_t vst3_param_id, double vst3_normalized_value, - uint32_t * clap_param_id, + char * clap_param_id, clap_param_value *clap_normalized_value); // converts the vst3 param id and plain value to clap param id and // plain value. // [thread-safe] bool (*convert_plain_value)(clap_plugin * plugin, - uint32_t vst3_param_index, + uint32_t vst3_param_id, double vst3_plain_value, - uint32_t * clap_param_index, + char * 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,11 +19,11 @@ typedef enum clap_param_type { typedef struct clap_param_info { /* param info */ int32_t index; - int32_t id; - char name[CLAP_NAME_SIZE]; // the display name - char module[CLAP_ID_SIZE]; // the module containing the param, eg: - // "/filters/moog"; '/' will be used as a - // separator to show a tree like structure. + char id[CLAP_ID_SIZE]; + 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 + // separator to show a tree like structure. bool is_per_note; // does this param supports per note automations? bool is_per_channel; // does this param supports per channel automations? diff --git a/include/clap/string-sizes.h b/include/clap/string-sizes.h @@ -7,8 +7,9 @@ extern "C" { #endif typedef enum clap_string_size { - CLAP_ID_SIZE = 128, + CLAP_ID_SIZE = 64, CLAP_NAME_SIZE = 64, + CLAP_MODULE_SIZE = 128, } clap_string_size; #ifdef __cplusplus