clap

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

commit eaf22a6bb939c111978891e78796712011d99e6d
parent 0c7c587466c7f9d8cbbbc01a5dac78ff328ac859
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Wed,  5 May 2021 09:40:43 +0200

Use AU style plain parameters

Diffstat:
MCMakeLists.txt | 1+
Minclude/clap/events.h | 16+++++++++-------
Minclude/clap/ext/draft/vst2-convert.h | 12++++++------
Minclude/clap/ext/draft/vst3-convert.h | 10+++++-----
Minclude/clap/ext/params.h | 5-----
5 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.20) project(CLAP C) include_directories(include) diff --git a/include/clap/events.h b/include/clap/events.h @@ -27,7 +27,7 @@ typedef struct clap_event_note { } clap_event_note; typedef enum clap_note_expression { - // TODO range, 20 * log(K * x)? + // x >= 0, use 20 * log(4 * x) CLAP_NOTE_EXPRESSION_VOLUME, // pan, 0 left, 0.5 center, 1 right @@ -35,6 +35,8 @@ typedef enum clap_note_expression { // relative tuning in semitone, from -120 to +120 CLAP_NOTE_EXPRESSION_TUNING, + + // 0..1 CLAP_NOTE_EXPRESSION_VIBRATO, CLAP_NOTE_EXPRESSION_BRIGHTNESS, CLAP_NOTE_EXPRESSION_BREATH, @@ -46,10 +48,10 @@ typedef enum clap_note_expression { typedef struct clap_event_note_expression { clap_note_expression expression_id; - int32_t key; // 0..127, or -1 to match all keys - int32_t channel; // 0..15, or -1 to match all channels - double normalized_value; // see expression for the range - double normalized_ramp; + int32_t key; // 0..127, or -1 to match all keys + int32_t channel; // 0..15, or -1 to match all channels + double value; // see expression for the range + double ramp; } clap_event_note_expression; typedef union clap_param_value { @@ -62,8 +64,8 @@ typedef struct clap_event_param { int32_t key; int32_t channel; 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_param_value value; + double ramp; // valid until the end of the block or the next event } clap_event_param; typedef struct clap_event_transport { diff --git a/include/clap/ext/draft/vst2-convert.h b/include/clap/ext/draft/vst2-convert.h @@ -23,13 +23,13 @@ typedef struct clap_plugin_vst2_convert { bool (*restore_vst2_state)(clap_plugin *plugin, clap_istream *stream); // converts the vst2 param id and normalized value to clap param id and - // normalized value. + // plain value. // [thread-safe] - bool (*convert_normalize_value)(clap_plugin * plugin, - uint32_t vst2_param_id, - double vst2_normalized_value, - int32_t * clap_param_id, - clap_param_value *clap_normalized_value); + bool (*convert_normalized_value)(clap_plugin * plugin, + uint32_t vst2_param_id, + double vst2_normalized_value, + int32_t * clap_param_id, + clap_param_value *clap_plain_value); // converts the vst2 param id and plain value to clap param id and // plain value. diff --git a/include/clap/ext/draft/vst3-convert.h b/include/clap/ext/draft/vst3-convert.h @@ -22,11 +22,11 @@ typedef struct clap_plugin_vst3_convert { // converts the VST3 param id and normalized value to clap param id and // normalized value. // [thread-safe] - bool (*convert_normalize_value)(clap_plugin * plugin, - uint32_t vst3_param_id, - double vst3_normalized_value, - int32_t * clap_param_id, - clap_param_value *clap_normalized_value); + bool (*convert_normalized_value)(clap_plugin * plugin, + uint32_t vst3_param_id, + double vst3_normalized_value, + int32_t * clap_param_id, + clap_param_value *clap_plain_value); // converts the vst3 param id and plain value to clap param id and // plain value. diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h @@ -70,11 +70,6 @@ typedef struct clap_plugin_params { 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_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,