commit 88c01c8781a5b68c933b988ce388162fbc918d06
parent e9f087c2400babc7d9839cc788b70fef35940284
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Wed, 28 Apr 2021 19:07:21 +0200
more work
Diffstat:
5 files changed, 50 insertions(+), 41 deletions(-)
diff --git a/include/clap/clap.h b/include/clap/clap.h
@@ -30,13 +30,15 @@
#include <stdint.h>
#include "events.h"
-#include "string-sizes.h"
#include "macros.h"
+#include "string-sizes.h"
#ifdef __cplusplus
extern "C" {
#endif
+#define CLAP_VERSION CLAP_VERSION_MAKE(0, 4, 0)
+
/////////////
// PROCESS //
/////////////
@@ -60,8 +62,7 @@ typedef struct clap_audio_buffer {
double **data64;
int32_t channel_count;
uint32_t latency; // latency from/to the audio interface
- uint64_t constant_mask; // bitmask for each channel, 1 if the value is
- // constant for the whole buffer
+ uint64_t constant_mask; // mask & (1 << N) to test if channel N is constant
uint32_t port_id;
} clap_audio_buffer;
@@ -96,14 +97,14 @@ typedef struct clap_host {
void *host_data; // reserved pointer for the host
- /* Name and version are mandatory. */
- const char *name; // plugin name, eg: "BitwigStudio"
- const char *vendor;
- const char *url;
- const char *version; // the plugin version, eg: "1.3.14"
+ // name and version are mandatory.
+ const char *name; // eg: "Bitwig Studio"
+ const char *vendor; // eg: "Bitwig GmbH"
+ const char *url; // eg: "https://bitwig.com"
+ const char *version; // eg: "3.3.8"
- /* Query an extension.
- * [thread-safe] */
+ // Query an extension.
+ // [thread-safe]
const void *(*extension)(clap_host *host, const char *extension_id);
} clap_host;
@@ -125,8 +126,9 @@ typedef enum clap_plugin_type {
* Exemple: arpegiator */
CLAP_PLUGIN_EVENT_EFFECT = (1 << 2), // can be seen as midi effect
- /* Analyze audio and/or events, and produces analysis results,
- * but doesn't change audio. */
+ // Analyze audio and/or events.
+ // If this is the only type reported by the plugin, the host can assume that it wont change the
+ // audio and event signal.
CLAP_PLUGIN_ANALYZER = (1 << 3),
} clap_plugin_type;
@@ -142,6 +144,17 @@ typedef struct clap_plugin_descriptor {
const char *version; // eg: "1.4.4"
const char *description; // eg: "The spirit of analogue"
+ // Arbitrary list of keywords, separated by `;'
+ // They can be matched by the host search engine and used to classify the plugin.
+ // Some examples:
+ // "master;eq;spectrum"
+ // "compressor;analog;character"
+ // "reverb;plate;cathedral"
+ // "kick;analog;808;roland"
+ // "analog;character;roland;moog"
+ // "chip;chiptune;gameboy;nintendo;sega"
+ const char *keywords;
+
uint64_t plugin_type; // bitfield of clap_plugin_type
} clap_plugin_descriptor;
diff --git a/include/clap/events.h b/include/clap/events.h
@@ -32,15 +32,15 @@ typedef enum clap_note_expression {
// TODO range, 20 * log(K * x)?
CLAP_NOTE_EXPRESSION_VOLUME,
- // pan, -1 left, 1 right
+ // pan, 0 left, 0.5 center, 1 right
CLAP_NOTE_EXPRESSION_PAN,
- // relative tunind in semitone
+ // relative tuning in semitone, from -120 to +120
CLAP_NOTE_EXPRESSION_TUNING,
CLAP_NOTE_EXPRESSION_VIBRATO,
CLAP_NOTE_EXPRESSION_BRIGHTNESS,
CLAP_NOTE_EXPRESSION_BREATH,
- CLAP_NOTE_EXPRESSION_PRUSSURE,
+ CLAP_NOTE_EXPRESSION_PRESSURE,
CLAP_NOTE_EXPRESSION_TIMBRE,
// TODO...
@@ -50,7 +50,6 @@ 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
- int32_t control; // 0..127
double normalized_value; // see expression for the range
double normalized_ramp;
} clap_event_note_expression;
@@ -140,7 +139,7 @@ typedef struct clap_event {
} clap_event;
typedef struct clap_event_list {
- void *ctx;
+ void *ctx; // reserved pointer for the list
uint32_t (*size)(const clap_event_list *list);
diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h
@@ -19,25 +19,27 @@ typedef enum clap_param_type {
typedef struct clap_param_info {
/* param info */
int32_t index;
- int32_t id; // a string which identify the param
+ 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.
- bool is_per_note;
- bool is_per_channel;
- bool is_used; // is this parameter used by the patch?
- bool is_periodic; // after the last value, go back to the first one
- bool is_locked; // if true, the parameter can't be changed by the host
- bool is_automatable;
- bool is_hidden;
- bool is_bypass;
+
+ bool is_per_note; // does this param supports per note automations?
+ bool is_per_channel; // does this param supports per channel automations?
+ bool is_used; // is this parameter used by the patch?
+ bool is_periodic; // after the last value, go back to the first one
+ bool is_locked; // if true, the parameter can't be changed by the host
+ bool is_automatable; // can the host send param event to change it in the process call?
+ bool is_hidden; // it implies is_automatable == true. Don't show it to the user.
+ bool is_bypass; // used to merge the plugin and host bypass button.
/* value */
clap_param_type type;
clap_param_value min_value; // minimum plain value
clap_param_value max_value; // maximum plain value
clap_param_value default_value; // default plain value
+ int32_t enum_size; // the number of values in the enum, if type is an enum
} clap_param_info;
typedef struct clap_plugin_params {
@@ -47,9 +49,9 @@ typedef struct clap_plugin_params {
// Copies the parameter's info to param_info and returns true on success.
// [main-thread]
- bool (*get_info)(clap_plugin * plugin,
- int32_t param_index,
- clap_param_info *param_info);
+ bool (*get_info)(clap_plugin *plugin, int32_t param_index, clap_param_info *param_info);
+
+ int64_t (*get_enum_value)(clap_plugin *plugin, int32_t param_index, int32_t value_index);
// Gets the parameter plain value.
// [main-thread]
@@ -59,18 +61,12 @@ typedef struct clap_plugin_params {
// If the plupin is activated, then the host must send a param event
// in the next process call to update the audio processor.
// [main-thread]
- void (*set_value)(clap_plugin * plugin,
- int32_t param_index,
- clap_param_value plain_value);
+ void (*set_value)(clap_plugin *plugin, int32_t param_index, clap_param_value plain_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_index, double plain_value);
+ double (*norm_to_plain)(clap_plugin *plugin, int32_t param_index, double normalized_value);
// Formats the display text for the given parameter value.
// [thread-safe,lock-wait-free]
diff --git a/include/clap/macros.h b/include/clap/macros.h
@@ -8,11 +8,12 @@ extern "C" {
#define CLAP_VERSION_MAKE(Major, Minor, Revision) \
((((Major)&0xff) << 16) | (((Minor)&0xff) << 8) | ((Revision)&0xff))
-#define CLAP_VERSION CLAP_VERSION_MAKE(0, 4, 0)
+
#define CLAP_VERSION_MAJ(Version) (((Version) >> 16) & 0xff)
#define CLAP_VERSION_MIN(Version) (((Version) >> 8) & 0xff)
#define CLAP_VERSION_REV(Version) ((Version)&0xff)
+// Define CLAP_EXPORT
#if defined _WIN32 || defined __CYGWIN__
# ifdef __GNUC__
# define CLAP_EXPORT __attribute__((dllexport))
diff --git a/include/clap/stream.h b/include/clap/stream.h
@@ -7,7 +7,7 @@ extern "C" {
#endif
typedef struct clap_istream {
- void *ctx;
+ void *ctx; // reserved pointer for the stream
/* returns the number of bytes read.
* 0 for end of file.
@@ -16,7 +16,7 @@ typedef struct clap_istream {
} clap_istream;
typedef struct clap_ostream {
- void *ctx;
+ void *ctx; // reserved pointer for the stream
/* returns the number of bytes written.
* -1 on error. */