commit 32585f9a44efb1e2e48a4a74f8e06b8ba597d40f
parent e60cf2dc22a9c1d1c985a99e0dcec8c36f06c398
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Fri, 23 Apr 2021 19:57:56 +0200
Move logging into its own extension and refine some other things
Diffstat:
4 files changed, 49 insertions(+), 24 deletions(-)
diff --git a/include/clap/clap.h b/include/clap/clap.h
@@ -35,7 +35,7 @@ extern "C" {
#define CLAP_VERSION_MAKE(Major, Minor, Revision) \
((((Major)&0xff) << 16) | (((Minor)&0xff) << 8) | ((Revision)&0xff))
-#define CLAP_VERSION CLAP_VERSION_MAKE(0, 2, 0)
+#define CLAP_VERSION CLAP_VERSION_MAKE(0, 3, 0)
#define CLAP_VERSION_MAJ(Version) (((Version) >> 16) & 0xff)
#define CLAP_VERSION_MIN(Version) (((Version) >> 8) & 0xff)
#define CLAP_VERSION_REV(Version) ((Version)&0xff)
@@ -66,14 +66,6 @@ enum clap_string_size {
CLAP_NAME_SIZE = 64,
};
-enum clap_log_severity {
- CLAP_LOG_DEBUG = 0,
- CLAP_LOG_INFO = 1,
- CLAP_LOG_WARNING = 2,
- CLAP_LOG_ERROR = 3,
- CLAP_LOG_FATAL = 4,
-};
-
// Description of the plugin
#define CLAP_ATTR_DESCRIPTION "clap/description"
// Manufacturer name
@@ -185,14 +177,13 @@ struct clap_event_list {
/////////////
enum clap_process_status {
- /* Processing failed. The output buffer must be discarded. */
+ // Processing failed. The output buffer must be discarded.
CLAP_PROCESS_ERROR = 0,
- /* Processing succeed. */
+ // Processing succeed.
CLAP_PROCESS_CONTINUE = 1,
- /* Processing succeed, but no more processing is required, until next event.
- */
+ // Processing succeed, but no more processing is required, until next event.
CLAP_PROCESS_SLEEP = 2,
};
@@ -203,6 +194,9 @@ struct clap_audio_buffer {
float ** data32;
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
};
struct clap_transport {
@@ -248,8 +242,7 @@ struct clap_host {
void *host_data; // reserved pointer for the host
- /* Name and version could be attributes but it is convenient to
- * have it when debugging. Also they are mandatory. */
+ /* Name and version are mandatory. */
char name[CLAP_NAME_SIZE]; // plugin name, eg: "BitwigStudio"
char version[CLAP_NAME_SIZE]; // the plugin version, eg: "1.3.14"
@@ -261,13 +254,6 @@ struct clap_host {
char * buffer,
int32_t size);
- /* Log a message through the host.
- * [thread-safe] */
- void (*log)(struct clap_host * host,
- struct clap_plugin * plugin,
- enum clap_log_severity severity,
- const char * msg);
-
/* Query an extension.
* [thread-safe] */
const void *(*extension)(struct clap_host *host, const char *extension_id);
@@ -291,7 +277,8 @@ 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 */
+ /* Analyze audio and/or events, and produces analysis results,
+ * but doesn't change audio. */
CLAP_PLUGIN_ANALYZER = (1 << 3),
};
diff --git a/include/clap/ext/audio-ports.h b/include/clap/ext/audio-ports.h
@@ -24,6 +24,7 @@ struct clap_audio_port_info {
char name[CLAP_NAME_SIZE]; // useful in the debugger
bool is_input;
bool is_main;
+ bool is_cv; // control voltage
bool supports_64_bits; // 32 bit support is mandatory, the host chooses between 32 and 64.
int32_t channel_count;
enum clap_audio_port_channel_mapping channel_mapping;
diff --git a/include/clap/ext/draft/log.h b/include/clap/ext/draft/log.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "../../clap.h"
+
+#define CLAP_EXT_LOG "clap/draft/log"
+
+enum clap_log_severity {
+ CLAP_LOG_DEBUG = 0,
+ CLAP_LOG_INFO = 1,
+ CLAP_LOG_WARNING = 2,
+ CLAP_LOG_ERROR = 3,
+ CLAP_LOG_FATAL = 4,
+};
+
+struct clap_host_log {
+ // Log a message through the host.
+ // [thread-safe]
+ void (*log)(struct clap_host * host,
+ struct clap_plugin * plugin,
+ enum clap_log_severity severity,
+ const char * msg);
+};
+
+#ifdef __cplusplus
+}
+#endif
+\ No newline at end of file
diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h
@@ -27,10 +27,11 @@ struct clap_param_info {
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;
/* value */
enum clap_param_type type;
- union clap_param_value value; // current plain value
union clap_param_value min_value; // minimum plain value
union clap_param_value max_value; // maximum plain value
union clap_param_value default_value; // default plain value
@@ -76,6 +77,11 @@ struct clap_plugin_params {
union clap_param_value plain_value,
char * display,
uint32_t size);
+
+ bool (*get_param_value_from_display)(struct clap_plugin * plugin,
+ int32_t param_index,
+ const char * display,
+ union clap_param_value *plain_value);
};
struct clap_host_params {