commit 48e16b4bff3d4f35d0693e25a4959f878fe2c9f4
parent 857ad0532e0cb2c2268b4786da924341a524f3f1
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Thu, 22 Apr 2021 01:17:39 +0200
Big rework
Diffstat:
15 files changed, 423 insertions(+), 920 deletions(-)
diff --git a/.clang-format b/.clang-format
@@ -5,7 +5,7 @@ AccessModifierOffset: -3
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
-AlignConsecutiveDeclarations: false
+AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
@@ -22,8 +22,8 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
-BinPackArguments: true
-BinPackParameters: true
+BinPackArguments: false
+BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
@@ -50,7 +50,7 @@ BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
-ColumnLimit: 100
+ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
diff --git a/include/clap/clap.h b/include/clap/clap.h
@@ -2,7 +2,7 @@
* CLAP - CLever Audio Plugin
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
*
- * Copyright (c) 2014...2016 Alexandre BIQUE <bique.alexandre@gmail.com>
+ * Copyright (c) 2014...2021 Alexandre BIQUE <bique.alexandre@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,36 +23,35 @@
* THE SOFTWARE.
*/
-#ifndef CLAP_H
-# define CLAP_H
+#pragma once
-# ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
-# endif
+#endif
-# include <stddef.h>
-# include <stdbool.h>
-# include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
-# 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_MAJ(Version) (((Version) >> 16) & 0xff)
-# define CLAP_VERSION_MIN(Version) (((Version) >> 8) & 0xff)
-# define CLAP_VERSION_REV(Version) ((Version) & 0xff)
+#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_MAJ(Version) (((Version) >> 16) & 0xff)
+#define CLAP_VERSION_MIN(Version) (((Version) >> 8) & 0xff)
+#define CLAP_VERSION_REV(Version) ((Version)&0xff)
#if defined _WIN32 || defined __CYGWIN__
-# ifdef __GNUC__
-# define CLAP_EXPORT __attribute__ ((dllexport))
-# else
-# define CLAP_EXPORT __declspec(dllexport)
-# endif
+# ifdef __GNUC__
+# define CLAP_EXPORT __attribute__((dllexport))
+# else
+# define CLAP_EXPORT __declspec(dllexport)
+# endif
#else
-# if __GNUC__ >= 4
-# define CLAP_EXPORT __attribute__ ((visibility ("default")))
-# else
-# define CLAP_EXPORT
-# endif
+# if __GNUC__ >= 4
+# define CLAP_EXPORT __attribute__((visibility("default")))
+# else
+# define CLAP_EXPORT
+# endif
#endif
///////////////////////////
@@ -62,117 +61,93 @@ extern "C" {
struct clap_plugin;
struct clap_host;
-enum clap_string_size
-{
- CLAP_ID_SIZE = 64,
- CLAP_NAME_SIZE = 64,
- CLAP_DESC_SIZE = 256,
- CLAP_DISPLAY_SIZE = 64,
- CLAP_TAGS_SIZE = 256,
+enum clap_string_size {
+ CLAP_ID_SIZE = 128,
+ CLAP_NAME_SIZE = 64,
+ CLAP_DESC_SIZE = 256,
+ CLAP_DISPLAY_SIZE = 64,
+ CLAP_TAGS_SIZE = 256,
};
-enum clap_log_severity
-{
- CLAP_LOG_DEBUG = 0,
- CLAP_LOG_INFO = 1,
- CLAP_LOG_WARNING = 2,
- CLAP_LOG_ERROR = 3,
- CLAP_LOG_FATAL = 4,
+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"
+#define CLAP_ATTR_DESCRIPTION "clap/description"
// Product version string
-# define CLAP_ATTR_VERSION "clap/version"
+#define CLAP_ATTR_VERSION "clap/version"
// Manufacturer name
-# define CLAP_ATTR_MANUFACTURER "clap/manufacturer"
+#define CLAP_ATTR_MANUFACTURER "clap/manufacturer"
// Url to product
-# define CLAP_ATTR_URL "clap/url"
+#define CLAP_ATTR_URL "clap/url"
// Url to support page, or mail to support
-# define CLAP_ATTR_SUPPORT "clap/support"
+#define CLAP_ATTR_SUPPORT "clap/support"
// Should be "1" if the plugin supports tunning.
-# define CLAP_ATTR_SUPPORTS_TUNING "clap/supports_tuning"
+#define CLAP_ATTR_SUPPORTS_TUNING "clap/supports_tuning"
////////////////
// PARAMETERS //
////////////////
-union clap_param_value
-{
- bool b;
- float f;
- int32_t i;
+union clap_param_value {
+ bool b;
+ double d;
+ int64_t i;
};
////////////
// EVENTS //
////////////
-enum clap_event_type
-{
- CLAP_EVENT_NOTE_ON = 0, // note attribute
- CLAP_EVENT_NOTE_OFF = 1, // note attribute
- CLAP_EVENT_NOTE_CHOKE = 2, // note attribute
+enum clap_event_type {
+ CLAP_EVENT_NOTE_ON = 0, // note attribute
+ CLAP_EVENT_NOTE_OFF = 1, // note attribute
- CLAP_EVENT_PARAM_SET = 3, // param attribute
- CLAP_EVENT_PARAM_RAMP = 4, // param attribute
+ CLAP_EVENT_CHOKE = 2, // no attribute
- CLAP_EVENT_CONTROL = 5, // control attribute
- CLAP_EVENT_MIDI = 6, // midi attribute
+ CLAP_EVENT_PARAM_SET = 3, // param attribute
- CLAP_EVENT_PLAY = 12, // no attribute
- CLAP_EVENT_PAUSE = 13, // no attribute
- CLAP_EVENT_STOP = 14, // no attribute
- CLAP_EVENT_JUMP = 15, // attribute jump
+ /* MIDI Style */
+ CLAP_EVENT_CONTROL = 5, // control attribute
+ CLAP_EVENT_PROGRAM = 16, // program attribute
+ CLAP_EVENT_MIDI = 6, // midi attribute
- CLAP_EVENT_PROGRAM = 16, // program attribute
+ CLAP_EVENT_PLAY = 12, // no attribute
+ CLAP_EVENT_PAUSE = 13, // no attribute
+ CLAP_EVENT_STOP = 14, // no attribute
};
-struct clap_event_param
-{
- /* key/channel index */
- int8_t key; // 0..127
- int8_t channel; // 0..16
-
- /* parameter */
- int32_t index; // parameter index
- union clap_param_value value;
- float increment; // for param ramp
+struct clap_event_param {
+ int8_t key;
+ int8_t channel;
+ uint32_t index; // parameter index
+ union clap_param_value normalized_value;
+ double normalized_ramp;
};
/** Note On/Off event. */
-struct clap_event_note
-{
- int8_t key; // 0..127
- int8_t channel; // 0..15
- float pitch; // hertz
- float velocity; // 0..1
-};
-
-struct clap_event_control
-{
- int8_t key; // 0..127
- int8_t channel; // 0..15
- int8_t control; // 0..127
- float value; // 0..1
+struct clap_event_note {
+ int8_t key; // 0..127
+ int8_t channel; // 0..15
+ double velocity; // 0..1
};
-struct clap_event_midi
-{
- /* midi event */
- const uint8_t *buffer;
- int32_t size;
+struct clap_event_control {
+ int8_t key; // 0..127, or -1 to match all keys
+ int8_t channel; // 0..15, or -1 to match all channels
+ int8_t control; // 0..127
+ double value; // 0..1
};
-struct clap_event_jump
-{
- int32_t tempo; // tempo in samples
- int32_t bar; // the bar number
- int32_t bar_offset; // 0 <= bar_offset < tsig_denom * tempo
- int64_t song_time; // song time in micro seconds
- int32_t tsig_num; // time signature numerator
- int32_t tsig_denom; // time signature denominator
+struct clap_event_midi {
+ const uint8_t *buffer; // midi buffer
+ uint32_t size;
};
/**
@@ -190,90 +165,122 @@ struct clap_event_jump
* a preset from the filesystem, then parse it, do memory allocation,
* there is no guarentee that the preset will be loaded in time.
*/
-struct clap_event_program
-{
- int32_t bank_msb; // 0..0x7FFFFFFF
- int32_t bank_lsb; // 0..0x7FFFFFFF
- int32_t program; // 0..0x7FFFFFFF
+struct clap_event_program {
+ int32_t bank_msb; // 0..0x7FFFFFFF
+ int32_t bank_lsb; // 0..0x7FFFFFFF
+ int32_t program; // 0..0x7FFFFFFF
+};
+
+struct clap_event {
+ enum clap_event_type type;
+ uint32_t time; // offset from the first sample in the process block
+
+ union {
+ struct clap_event_note note;
+ struct clap_event_control control;
+ struct clap_event_param param;
+ struct clap_event_midi midi;
+ struct clap_event_program program;
+ };
};
-struct clap_event
-{
- struct clap_event *next; // linked list, NULL on end
- enum clap_event_type type;
- int64_t time; // offset from the first sample in the process block
- int32_t port; // event port id
-
- union {
- struct clap_event_note note;
- struct clap_event_control control;
- struct clap_event_param param;
- struct clap_event_midi midi;
- struct clap_event_jump jump;
- struct clap_event_program program;
- };
+struct clap_event_list {
+ int (*size)(const struct clap_event_istream *stream);
+ const struct clap_event *(*get)(const struct clap_event_istream *stream,
+ int index);
+ void (*push_back)(struct clap_event_istream *stream,
+ const struct clap_event * event);
};
/////////////
// PROCESS //
/////////////
-enum clap_process_status
-{
- /* Processing failed. The output buffer must be discarded. */
- CLAP_PROCESS_ERROR = 0,
+enum clap_process_status {
+ /* Processing failed. The output buffer must be discarded. */
+ CLAP_PROCESS_ERROR = 0,
- /* Processing succeed. */
- CLAP_PROCESS_CONTINUE = 1,
+ /* Processing succeed. */
+ CLAP_PROCESS_CONTINUE = 1,
- /* Processing succeed, but no more processing is required, until next event. */
- CLAP_PROCESS_SLEEP = 2,
+ /* Processing succeed, but no more processing is required, until next event.
+ */
+ CLAP_PROCESS_SLEEP = 2,
};
-struct clap_process
-{
- /* number of frame to process */
- int32_t frames_count;
+struct clap_audio_buffer {
+ // if data is null, then assume that the input has the value 0 for each
+ // samples. data[i] for channel i buffer
+ float **data;
+ int32_t channel_count;
+};
- /* process info */
- int64_t steady_time; // the steady time in samples
+struct clap_transport {
+ bool is_playing;
+ bool is_recording;
+ bool is_looping;
- /* Linked list of events
- * The plugin must not modify those events. */
- struct clap_event *in_events;
- struct clap_event *out_events;
-};
+ double tempo; // tempo in bpm
-//////////
-// HOST //
-//////////
+ double song_pos; // position in beats
+ double bar_start; // start pos of the current bar
+ double loop_start;
+ double loop_end;
-struct clap_host
-{
- int32_t clap_version; // initialized to CLAP_VERSION
+ int16_t tsig_num; // time signature numerator
+ int16_t tsig_denom; // time signature denominator
- void *host_data; // reserved pointer for the host
+ int64_t steady_time; // the steady time in samples
+};
- char name[CLAP_NAME_SIZE]; // plugin name, eg: "BitwigStudio"
- char version[CLAP_NAME_SIZE]; // the plugin version, eg: "1.3.14"
+struct clap_process {
+ int32_t frames_count; // number of frame to process
- /* returns the size of the original string, 0 if not string
- * [thread-safe] */
- int32_t (*get_attribute)(struct clap_host *host,
- const char *attr,
- char *buffer,
- int32_t size);
+ struct clap_transport transport;
- /* 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);
+ /* audio ports */
+ const struct clap_audio_buffer *audio_in;
+ const struct clap_audio_buffer *audio_out;
+ int audio_in_count;
+ int audio_out_count;
- /* query an extension
- * [thread-safe] */
- const void *(*extension)(struct clap_host *host, const char *extention_id);
+ /* events */
+ const struct clap_event_list *in_events;
+ struct clap_event_list * out_events;
+};
+
+//////////
+// HOST //
+//////////
+
+struct clap_host {
+ int32_t clap_version; // initialized to CLAP_VERSION
+
+ 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. */
+ char name[CLAP_NAME_SIZE]; // plugin name, eg: "BitwigStudio"
+ char version[CLAP_NAME_SIZE]; // the plugin version, eg: "1.3.14"
+
+ /* Returns the size of the original string. If this is larger than size, then
+ * the function did not have enough space to copy all the data.
+ * [thread-safe] */
+ int32_t (*get_attribute)(struct clap_host *host,
+ const char * attr,
+ 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 *extention_id);
};
////////////
@@ -282,128 +289,96 @@ struct clap_host
/* bitfield
* This gives an hint to the host what the plugin might do. */
-enum clap_plugin_type
-{
- /* Instruments can play notes, and generate audio */
- CLAP_PLUGIN_INSTRUMENT = (1 << 0),
-
- /* Audio effects, process audio input and produces audio.
- * Exemple: delay, reverb, compressor. */
- CLAP_PLUGIN_AUDIO_EFFECT = (1 << 1),
-
- /* Event effects, takes events as input and produces events.
- * Exemple: arpegiator */
- CLAP_PLUGIN_EVENT_EFFECT = (1 << 2), // can be seen as midi effect
-
- /* Analyze audio and/or events, and produces analysis results */
- CLAP_PLUGIN_ANALYZER = (1 << 3),
-
- /* This plugin is a modular system, so it can load "modules",
- * have dynamic number of ports and parameters.
- * In short it could do anything. */
- CLAP_PLUGIN_PATCHER = (1 << 4),
-
- /* This plugin streams the audio signal.
- * For example it can stream to a web radio.
- * This is important to not block the process loop. */
- CLAP_PLUGIN_STREAMER = (1 << 5),
-
- /* This plugin act as a proxy, so it forwards the events/audio
- * to an other program on the same machine or on the network.
- *
- * For example a wine bridge which runs Windows plugins on Linux,
- * is a proxy. A plugin which sends the data to an hardware device
- * is a proxy as well. */
- CLAP_PLUGIN_PROXY = (1 << 6),
-
- /* This plugin is a sampler, and can be used to load generic
- * audio files. */
- CLAP_PLUGIN_SAMPLER = (1 << 7),
+enum clap_plugin_type {
+ /* Instruments can play notes, and generate audio */
+ CLAP_PLUGIN_INSTRUMENT = (1 << 0),
+
+ /* Audio effects, process audio input and produces audio.
+ * Exemple: delay, reverb, compressor. */
+ CLAP_PLUGIN_AUDIO_EFFECT = (1 << 1),
+
+ /* Event effects, takes events as input and produces events.
+ * Exemple: arpegiator */
+ CLAP_PLUGIN_EVENT_EFFECT = (1 << 2), // can be seen as midi effect
+
+ /* Analyze audio and/or events, and produces analysis results */
+ CLAP_PLUGIN_ANALYZER = (1 << 3),
};
-struct clap_plugin
-{
- int32_t clap_version; // initialized to CLAP_VERSION
-
- void *host_data; // reserved pointer for the host
- void *plugin_data; // reserved pointer for the plugin
-
- /* The 3 following strings are here because:
- * - they are mandatory
- * - it is convenient when you debug, to be able to see
- * the plugin name, id and version by displaying
- * the structure.
- */
- char name[CLAP_NAME_SIZE]; // plugin name, eg: "Diva"
- char id[CLAP_ID_SIZE]; // plugin id, eg: "u-he/diva"
- char version[CLAP_NAME_SIZE]; // the plugin version, eg: "1.3.2"
-
- enum clap_plugin_type plugin_type;
-
- /* Free the plugin and its resources.
- * It is not required to deactivate the plugin prior to this call. */
- void (*destroy)(struct clap_plugin *plugin);
-
- /* Copy at most size of the attribute's value into buffer.
- * This function must place a '\0' byte at the end of the string.
- * Returns the size of the original string or 0 if there is no
- * value for this attributes.
- * [thread-safe] */
- int32_t (*get_attribute)(struct clap_plugin *plugin,
- const char *attr,
- char *buffer,
- int32_t size);
-
- /* activation/deactivation
- * [audio-thread] */
- bool (*activate)(struct clap_plugin *plugin);
- void (*deactivate)(struct clap_plugin *plugin);
-
- /* process audio, events, ...
- * [audio-thread] */
- enum clap_process_status (*process)(struct clap_plugin *plugin,
- struct clap_process *process);
-
- /* query an extension
- * [thread-safe] */
- const void *(*extension)(struct clap_plugin *plugin, const char *id);
+struct clap_plugin {
+ int32_t clap_version; // initialized to CLAP_VERSION
+
+ void *plugin_data; // reserved pointer for the plugin
+
+ /* The 3 following strings are here because:
+ * - they are mandatory
+ * - it is convenient when you debug, to be able to see
+ * the plugin name, id and version by displaying
+ * the structure.
+ */
+ char name[CLAP_NAME_SIZE]; // plugin name, eg: "Diva"
+ char id[CLAP_ID_SIZE]; // plugin id, eg: "com.u-he.diva"
+ char version[CLAP_NAME_SIZE]; // the plugin version, eg: "1.3.2"
+
+ enum clap_plugin_type plugin_type;
+
+ /* Free the plugin and its resources.
+ * It is not required to deactivate the plugin prior to this call. */
+ void (*destroy)(struct clap_plugin *plugin);
+
+ /* Copy at most size of the attribute's value into buffer.
+ * This function must place a '\0' byte at the end of the string.
+ * Returns the size of the original string or 0 if there is no
+ * value for this attributes.
+ * [thread-safe] */
+ int32_t (*get_attribute)(struct clap_plugin *plugin,
+ const char * attr,
+ char * buffer,
+ int32_t size);
+
+ /* activation/deactivation
+ * [main-thread] */
+ bool (*activate)(struct clap_plugin *plugin, int sample_rate);
+ void (*deactivate)(struct clap_plugin *plugin);
+
+ /* process audio, events, ...
+ * [audio-thread] */
+ enum clap_process_status (*process)(struct clap_plugin * plugin,
+ struct clap_process *process);
+
+ /* query an extension
+ * [thread-safe] */
+ const void *(*extension)(struct clap_plugin *plugin, const char *id);
};
/* This interface is the entry point of the dynamic library.
*
- * Every methods must be thread-safe.
- *
- * Common sample rate values are: 44100, 48000, 88200, 96000,
- * 176400, 192000. */
-struct clap_plugin_factory
-{
- /* Get the number of plugins available.
- * [thread-safe] */
- int32_t (*get_plugin_count)(struct clap_plugin_factory *factory);
-
- /* Create a clap_plugin by its index.
- * Valid indexes are from 0 to get_plugin_count() - 1.
- * Returns null in case of error.
- * [thread-safe] */
- struct clap_plugin *(*create_plugin_by_index)(struct clap_plugin_factory *factory,
- struct clap_host *host,
- int32_t sample_rate,
- int32_t index);
-
- /* Create a clap_plugin by its plugin_id.
- * Returns null in case of error.
- * [thread-safe] */
- struct clap_plugin *(*create_plugin_by_id)(struct clap_plugin_factory *factory,
- struct clap_host *host,
- int32_t sample_rate,
- const char *plugin_id);
+ * Every methods must be thread-safe. */
+struct clap_plugin_entry {
+ void (*init)(const char *plugin_path);
+ void (*deinit)(void);
+
+ /* Get the number of plugins available.
+ * [thread-safe] */
+ int32_t (*get_plugin_count)(void);
+
+ /* Create a clap_plugin by its index.
+ * Valid indexes are from 0 to get_plugin_count() - 1.
+ * Returns null in case of error.
+ * [thread-safe] */
+ struct clap_plugin *(*create_plugin_by_index)(struct clap_host *host,
+ int32_t index);
+
+ /* Create a clap_plugin by its plugin_id.
+ * Returns null in case of error.
+ * [thread-safe] */
+ struct clap_plugin *(*create_plugin_by_id)(struct clap_host *host,
+ const char * plugin_id);
};
/* Entry point */
-CLAP_EXPORT extern const struct clap_plugin_factory *clap_plugin_factory;
+CLAP_EXPORT extern const struct clap_plugin_entry *clap_plugin_entry;
-# ifdef __cplusplus
+#ifdef __cplusplus
}
-# endif
-
-#endif /* !CLAP_H */
+#endif
+\ No newline at end of file
diff --git a/include/clap/ext/audio-ports.h b/include/clap/ext/audio-ports.h
@@ -1,111 +1,62 @@
-#ifndef CLAP_EXT_AUDIO_PORTS_H
-# define CLAP_EXT_AUDIO_PORTS_H
+#pragma once
-# ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
-# endif
+#endif
-# include "../clap.h"
+#include "../clap.h"
-# define CLAP_EXT_AUDIO_PORTS "clap/audio-ports"
+#define CLAP_EXT_AUDIO_PORTS "clap/audio-ports"
-enum clap_audio_port_channel_mapping
-{
- CLAP_AUDIO_PORT_UNSPECIFIED = 0,
- CLAP_AUDIO_PORT_MONO = 1,
+enum clap_audio_port_channel_mapping {
+ CLAP_AUDIO_PORT_UNSPECIFIED = 0,
+ CLAP_AUDIO_PORT_MONO = 1,
- // left, right
- CLAP_AUDIO_PORT_STEREO = 2,
+ // left, right
+ CLAP_AUDIO_PORT_STEREO = 2,
- // front left, front right, center, low, surround left, surround right
- // surround back left, surround back right
- CLAP_AUDIO_PORT_SURROUND = 3,
+ // front left, front right, center, low, surround left, surround right
+ // surround back left, surround back right
+ CLAP_AUDIO_PORT_SURROUND = 3,
};
-enum clap_audio_port_role
-{
- CLAP_AUDIO_PORT_INOUT = 0,
- CLAP_AUDIO_PORT_SIDECHAIN = 1,
- CLAP_AUDIO_PORT_MODULATION = 2,
+struct clap_audio_port_info {
+ char name[CLAP_NAME_SIZE]; // useful in the debugger
+ bool is_input;
+ bool is_main;
+ int32_t channel_count;
+ enum clap_audio_port_channel_mapping channel_mapping;
};
-struct clap_audio_port_info
-{
- int32_t id;
- bool is_input;
- int32_t channel_count;
- enum clap_audio_port_channel_mapping channel_mapping;
- enum clap_audio_port_role role;
- char name[CLAP_NAME_SIZE];
-
- /* If true, then this is a virtual port which can be cloned
- * and connected multiple times.
- * Only useful for input ports. */
- bool is_cloneable;
-};
-
-struct clap_audio_port
-{
- int32_t channel_count;
- enum clap_audio_port_channel_mapping channel_mapping;
- float **data;
-};
-
-/* The audio ports configuration has to be done while the plugin is
- * deactivated. */
-struct clap_plugin_audio_ports
-{
- /* number of ports, including inputs and outputs
- * [audio-thread] */
- int32_t (*get_count)(struct clap_plugin *plugin);
-
- /* get info about about an audio port.
- * [audio-thread] */
- void (*get_info)(struct clap_plugin *plugin,
- int32_t index,
- struct clap_audio_port_info *info);
-
- /* Connect the given port to the plugin's port at index.
- * user_name is the name of the peer port given by the host/user.
- * It can be useful especialy for repeatable ports.
- * Returns the id of the port. In case of repeatable port,
- * make sure that each connected port has a different id.
- * Returns -1 if the connection failed.
- * [audio-thread] */
- int32_t (*connect)(struct clap_plugin *plugin,
- int32_t port_id,
- const struct clap_audio_port *port,
- const char *user_name);
-
- /* Disconnects a port.
- * [audio-thread] */
- void (*disconnect)(struct clap_plugin *plugin,
- int32_t port_id);
-
- /* Returns the absolute port latency in samples.
- * [audio-thread] */
- int32_t (*get_latency)(struct clap_plugin *plugin,
- int32_t port_id);
+// The audio ports scan has to be done while the plugin is deactivated.
+struct clap_plugin_audio_ports {
+ // number of ports, both inputs and outputs
+ // [main-thread]
+ int32_t (*get_count)(struct clap_plugin *plugin);
+
+ // get info about about an audio port.
+ // [main-thread]
+ void (*get_info)(struct clap_plugin * plugin,
+ int32_t index,
+ struct clap_audio_port_info *info);
+
+ // Returns the port latency.
+ // [main-thread]
+ int32_t (*get_latency)(struct clap_plugin *plugin, int32_t index);
};
-struct clap_host_audio_ports
-{
- /* Tell the host that the plugin ports has changed.
- * The host shall deactivate the plugin and then
- * scan the ports again.
- * [thread-safe] */
- void (*changed)(struct clap_host *host,
- struct clap_plugin *plugin);
+struct clap_host_audio_ports {
+ // Tell the host that the plugin ports has changed.
+ // The host shall deactivate the plugin and then scan the ports again.
+ // [main-thread]
+ void (*changed)(struct clap_host *host, struct clap_plugin *plugin);
- /* Tell the host that the latency changed. The host should
- * call get_port_latency on each ports.
- * [thread-safe] */
- void (*latency_changed)(struct clap_host *host,
- struct clap_plugin *plugin);
+ // Tell the host that the latency changed.
+ // The host should call get_port_latency on each ports.
+ // [main-thread]
+ void (*latency_changed)(struct clap_host *host, struct clap_plugin *plugin);
};
-# ifdef __cplusplus
+#ifdef __cplusplus
}
-# endif
-
-#endif /* !CLAP_EXT_PORT_H */
+#endif
diff --git a/include/clap/ext/draft/drum-map.h b/include/clap/ext/draft/drum-map.h
@@ -1,49 +0,0 @@
-#ifndef CLAP_EXT_DRUM_MAP_H
-# define CLAP_EXT_DRUM_MAP_H
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# include "../../clap.h"
-
-# define CLAP_EXT_DRUM_MAP "clap/draft/drum-map"
-
-struct clap_drum_map_key_info
-{
- char name[CLAP_NAME_SIZE];
- int8_t key;
- int8_t channel; // -1 for every channels
-};
-
-struct clap_plugin_drum_map
-{
- /* Get the number of keys which have a drum map info on
- * the given port_id.
- * [thread-safe] */
- int32_t (*get_key_count)(struct clap_plugin *plugin,
- int32_t port_id);
-
- /* Loads the info for the given event port and key index.
- * Returns true on success, false if the info could not be
- * loaded.
- * [thread-safe] */
- bool (*get_key_info)(struct clap_plugin *plugin,
- int32_t port_id,
- int32_t index,
- struct clap_drum_map_key_info *info);
-};
-
-struct clap_host_drum_map
-{
- /* Inform the host that the drum map has changed.
- * [thread-safe] */
- void (*drum_map_changed)(struct clap_host *host,
- struct clap_plugin *plugin);
-};
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* !CLAP_EXT_DRUM_MAP_H */
diff --git a/include/clap/ext/draft/locale.h b/include/clap/ext/draft/locale.h
@@ -1,23 +0,0 @@
-#ifndef CLAP_EXT_LOCALE_H
-# define CLAP_EXT_LOCALE_H
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# include "../../clap.h"
-
-# define CLAP_EXT_LOCALE "clap/draft/locale"
-
-struct clap_plugin_locale
-{
- /* Sets the locale to use.
- * [thread-safe] */
- bool (*set_locale)(struct clap_plugin *plugin, const char *locale);
-};
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* !CLAP_EXT_LOCALE_H */
diff --git a/include/clap/ext/draft/presets.h b/include/clap/ext/draft/presets.h
@@ -1,106 +0,0 @@
-#ifndef CLAP_EXT_PRESETS_H
-# define CLAP_EXT_PRESETS_H
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# include "../../clap.h"
-
-# define CLAP_EXT_PRESETS "clap/draft/presets"
-
-/* describes a single preset */
-struct clap_preset_info
-{
- char plugin_id[CLAP_ID_SIZE]; // used to identify which plugin can load the preset
- char id[CLAP_ID_SIZE]; // used to identify a preset in a preset bank
- char name[CLAP_NAME_SIZE]; // preset name
- char desc[CLAP_DESC_SIZE]; // desc and how to use it
- char author[CLAP_NAME_SIZE]; // author's name
- char categories[CLAP_TAGS_SIZE]; // "cat1;cat2;cat3;..."
- char tags[CLAP_TAGS_SIZE]; // "tag1;tag2;tag3;..."
- int8_t score; // 0 = garbage, ..., 100 = best, -1 = no score
-};
-
-/* Interface implemented by the plugin.
- * Used to create a preset library, get info about the current preset and
- * load a preset. */
-struct clap_plugin_preset
-{
- /* Create a preset library for this plugin
- * [thread-safe] */
- struct clap_preset_library *(*create_preset_library)(struct clap_plugin *plugin);
-
- /* Get the current preset info
- * [thread-safe] */
- bool (*get_current_preset_info)(struct clap_plugin *plugin,
- struct clap_preset_info *preset);
-
- /* Load a preset from a bank file
- * [audio-thread] */
- bool (*load_preset)(struct clap_plugin *plugin,
- const char *path,
- const char *preset_id);
-};
-
-/* opaque type */
-struct clap_bank_handle;
-
-/* The principle behind this extension is that the host gets a list of
- * directories to scan recursively, and then for each files, it can ask
- * the interface to load the preset.
- *
- * Every file are considered as preset bank, so they can contain between
- * 0 and many presets. */
-struct clap_preset_library
-{
- /* The identifier of the preset library.
- * As one preset library might be able to parse the presets for
- * multiple different plugins, it is useful to identify a
- * preset library by an id and a version, so the DAW can use
- * the most recent version of every preset library which share
- * the same id, and scan only once. */
- char id[CLAP_ID_SIZE];
- int32_t version; // version of the preset library
-
- /* Copies at most *path_size bytes into path.
- * If directory_index is bigger than the number of directories,
- * then return false.
- * [thread-safe] */
- bool (*get_directory)(struct clap_preset_library *library,
- int directory_index,
- char *path,
- int32_t *path_size);
-
- /* [thread-safe] */
- bool (*open_bank)(struct clap_preset_library *library,
- const char *path,
- struct clap_bank_handle **handle);
-
- /* [thread-safe] */
- void (*close_bank)(struct clap_preset_library *library,
- struct clap_bank_handle *handle);
-
- /* Returns the number of presets in the bank.
- * If it is not known, return -2.
- * On error return -1.
- * [thread-safe] */
- int32_t (*get_bank_size)(struct clap_preset_library *library,
- struct clap_bank_handle *handle);
-
- /* Get a preset info from its path and returns true.
- * In case of a preset bank file, index is used, and *has_next
- * should be set to false when index reaches the last preset.
- * If the preset is not found, then it should return false.
- * [thread-safe] */
- bool (*get_bank_preset)(struct clap_preset_library *library,
- struct clap_bank_handle *handle,
- struct clap_preset_info *preset_info,
- int32_t index);
-};
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* !CLAP_EXT_PRESETS_H */
diff --git a/include/clap/ext/embed-cocoa.h b/include/clap/ext/embed-cocoa.h
@@ -1,35 +0,0 @@
-#ifndef CLAP_EXT_EMBED_COCOA_H
-# define CLAP_EXT_EMBED_COCOA_H
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# include "../clap.h"
-# include "embed.h"
-
-# define CLAP_EXT_EMBED_COCOA "clap/embed/cocoa"
-
-struct clap_plugin_embed_cocoa
-{
- /* Get the size of the plugin UI.
- * [thread-safe] */
- void (*get_size)(struct clap_plugin *plugin,
- int32_t *width,
- int32_t *height);
-
- /* Attach the plugin UI.
- * [thread-safe] */
- bool (*attach)(struct clap_plugin *plugin,
- void *nsView);
-
- /* Detach the plugin UI.
- * [thread-safe] */
- bool (*detach)(struct clap_plugin *plugin);
-};
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* !CLAP_EXT_EMBED_COCOA_H */
diff --git a/include/clap/ext/embed-win32.h b/include/clap/ext/embed-win32.h
@@ -1,36 +0,0 @@
-#ifndef CLAP_EXT_EMBED_WIN32_H
-# define CLAP_EXT_EMBED_WIN32_H
-
-# include <windows.h>
-
-# include "../clap.h"
-# include "embed.h"
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# define CLAP_EXT_EMBED_WIN32 "clap/embed/win32"
-
-struct clap_plugin_embed_win32
-{
- /* Get the size of the plugin UI.
- * [thread-safe] */
- void (*get_size)(struct clap_plugin *plugin,
- int32_t *width,
- int32_t *height);
-
- /* Attach the plugin UI.
- * [thread-safe] */
- bool (*attach)(struct clap_plugin *plugin, HWND window);
-
- /* Detach the plugin UI.
- * [thread-safe] */
- bool (*detach)(struct clap_plugin *plugin);
-};
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* !CLAP_EXT_EMBED_WIN32_H */
diff --git a/include/clap/ext/embed-x11.h b/include/clap/ext/embed-x11.h
@@ -1,41 +0,0 @@
-#ifndef CLAP_EXT_EMBED_X11_H
-# define CLAP_EXT_EMBED_X11_H
-
-# include "../clap.h"
-# include "embed.h"
-
-# define CLAP_EXT_EMBED_X11 "clap/embed/x11"
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-struct clap_plugin_embed_x11
-{
- /* Get the size of the plugin UI.
- * [thread-safe] */
- void (*get_size)(struct clap_plugin *plugin,
- int32_t *width,
- int32_t *height);
-
- /* Note for the client, you can get a Display* by calling
- * XOpenDisplay(display_name).
- *
- * Note for the host, the display_name can be retrieved from your own
- * display->display_name.
- *
- * [thread-safe] */
- bool (*attach)(struct clap_plugin *plugin,
- const char *display_name,
- unsigned long window);
-
- /* Detach the plugin UI.
- * [thread-safe] */
- bool (*detach)(struct clap_plugin *plugin);
-};
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* !CLAP_EMBED_XLIB_H */
diff --git a/include/clap/ext/embed.h b/include/clap/ext/embed.h
@@ -1,24 +0,0 @@
-#ifndef CLAP_EXT_EMBED_H
-# define CLAP_EXT_EMBED_H
-
-# include "../clap.h"
-
-# define CLAP_EXT_EMBED "clap/embed"
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-struct clap_host_embed
-{
- /* Request the host to resize the client area to width, height.
- * Return true on success, false otherwise.
- * [thread-safe] */
- bool (*resize)(struct clap_host *host, int32_t width, int32_t height);
-};
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* !CLAP_EXT_EMBED_H */
diff --git a/include/clap/ext/event-ports.h b/include/clap/ext/event-ports.h
@@ -1,69 +0,0 @@
-#ifndef CLAP_EVENT_PORTS_H
-# define CLAP_EVENT_PORTS_H
-
-# include "../clap.h"
-
-# define CLAP_EXT_EVENT_PORTS "clap/event-ports"
-
-# define CLAP_MAIN_EVENT_PORT_ID 0
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-struct clap_audio_port_info
-{
- /* This number uniquely identify the port.
- * There are two id space, one for the input event ports,
- * and one for the output event ports.
- * Valid ids are greater than 0.
- * Every clap plugins always have one input event port and
- * one output event port, their id is 0 (CLAP_MAIN_EVENT_PORT_ID).
- *
- * So one plugin only need this extension for additional ports. */
- int32_t id;
- bool is_input;
- char name[CLAP_NAME_SIZE];
-
- /* If true, then this is a virtual port which can be cloned
- * and connected multiple times.
- * Only useful for input ports. */
- bool is_cloneable;
-};
-
-struct clap_plugin_event_ports
-{
- /* number of ports, including inputs and outputs
- * [audio-thread] */
- int32_t (*get_count)(struct clap_plugin *plugin);
-
- /* get info about about an event port.
- * [audio-thread] */
- void (*get_info)(struct clap_plugin *plugin,
- int32_t index,
- struct clap_event_port_info *info);
-
- /* Clones a clonable port.
- * On success returns a unique port id, for the cloned port.
- * On failure, returns -1.
- * user_name is a string provided by the host to tell the
- * plugin how to name the new cloned port.
- *
- * [audio-thread]
- */
- int32_t (*clone_port)(struct clap_plugin *plugin,
- int32_t port_id,
- const char *user_name);
-
- /* When the host is done with a cloned port, it can call
- * release_port() to release the resources.
- * [audio-thread]*/
- int32_t (*release_port)(struct clap_plugin *plugin,
- int32_t port_id);
-};
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* !EVENT_PORTS_H */
diff --git a/include/clap/ext/gui.h b/include/clap/ext/gui.h
@@ -1,44 +1,34 @@
#ifndef CLAP_EXT_GUI_H
-# define CLAP_EXT_GUI_H
+#define CLAP_EXT_GUI_H
-# include "../clap.h"
+#include "../clap.h"
-# define CLAP_EXT_GUI "clap/gui"
+#define CLAP_EXT_GUI "clap/gui"
-# ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
-# endif
+#endif
-struct clap_plugin_gui
-{
- /* Open the GUI
- * [thread-safe] */
- bool (*open)(struct clap_plugin *plugin);
+struct clap_plugin_gui {
+ // Get the size of the plugin UI.
+ // [main-thread]
+ void (*get_size)(struct clap_plugin *plugin,
+ int32_t * width,
+ int32_t * height);
- /* [thread-safe] */
- void (*hide)(struct clap_plugin *plugin);
-
- /* [thread-safe] */
- void (*close)(struct clap_plugin *plugin);
+ // [main-thread]
+ void (*close)(struct clap_plugin *plugin);
};
-struct clap_host_gui
-{
- /* [thread-safe] */
- void (*gui_opened)(struct clap_host *host,
- struct clap_plugin *plugin);
-
- /* [thread-safe] */
- void (*gui_hidden)(struct clap_host *host,
- struct clap_plugin *plugin);
-
- /* [thread-safe] */
- void (*gui_closed)(struct clap_host *host,
- struct clap_plugin *plugin);
+struct clap_host_gui {
+ /* Request the host to resize the client area to width, height.
+ * Return true on success, false otherwise.
+ * [thread-safe] */
+ bool (*resize)(struct clap_host *host, int32_t width, int32_t height);
};
-# ifdef __cplusplus
+#ifdef __cplusplus
}
-# endif
+#endif
#endif /* !CLAP_EXT_GUI_H */
diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h
@@ -1,134 +1,112 @@
-#ifndef CLAP_EXT_PARAMS_H
-# define CLAP_EXT_PARAMS_H
+#pragma once
-# include "../clap.h"
-# include "ports.h"
+#include "../clap.h"
#ifdef __cplusplus
extern "C" {
#endif
-# define CLAP_EXT_PARAMS "clap/params"
-# define CLAP_ROOT_MODULE_ID ""
+#define CLAP_EXT_PARAMS "clap/params"
+#define CLAP_ROOT_MODULE_ID ""
-enum clap_param_type
-{
- CLAP_PARAM_FLOAT = 0, // uses value.f
- CLAP_PARAM_BOOL = 1, // uses value.b
- CLAP_PARAM_INT = 2, // uses value.i
- CLAP_PARAM_ENUM = 3, // uses value.i
-};
-
-/* This is useful for the knob scaling. */
-enum clap_param_scale
-{
- CLAP_PARAM_SCALE_LINEAR = 0,
- CLAP_PARAM_SCALE_LOG = 1,
- CLAP_PARAM_SCALE_EXP = 2,
+enum clap_param_type {
+ CLAP_PARAM_FLOAT = 0, // uses value.d
+ CLAP_PARAM_BOOL = 1, // uses value.b
+ CLAP_PARAM_INT = 2, // uses value.i
+ CLAP_PARAM_ENUM = 3, // uses value.i
};
/* This describes the parameter and provides the current value */
-struct clap_param
-{
- int32_t index; // parameter's index
-
- /* param info */
- char module_id[CLAP_ID_SIZE];
- char id[CLAP_ID_SIZE]; // a string which identify the param
- char name[CLAP_NAME_SIZE]; // the display name
- char desc[CLAP_DESC_SIZE];
- char display[CLAP_DISPLAY_SIZE]; // the text used to display the value
- 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
-
- /* Can the parameter be automated at sample rate by an audio buffer? */
- bool supports_audio_automation;
-
- /* Can the parameter be automated by automation events? */
- bool supports_events_automation;
- bool supports_ramp_events;
-
- /* value */
- enum clap_param_type type;
- union clap_param_value value; // current value
- union clap_param_value min; // minimum value
- union clap_param_value max; // maximum value
- union clap_param_value deflt; // default value
- enum clap_param_scale scale; // scaling of the knob in the UI.
+struct clap_param {
+ /* param info */
+ char id[CLAP_ID_SIZE]; // a string which identify the param
+ char module[CLAP_ID_SIZE];
+ char name[CLAP_NAME_SIZE]; // the display name
+ char desc[CLAP_DESC_SIZE];
+ char display[CLAP_DISPLAY_SIZE]; // the text used to display the value
+ 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;
+
+ /* value */
+ enum clap_param_type type;
+ union clap_param_value plain_value; // current value
+ union clap_param_value normalized_value;
+ union clap_param_value min; // minimum value
+ union clap_param_value max; // maximum value
+ union clap_param_value deflt; // default value
};
-struct clap_param_module
-{
- char id[CLAP_ID_SIZE];
- char parent_id[CLAP_ID_SIZE];
- char name[CLAP_NAME_SIZE];
- char desc[CLAP_DESC_SIZE];
+struct clap_param_module {
+ char id[CLAP_ID_SIZE];
+ char parent_id[CLAP_ID_SIZE];
+ char name[CLAP_NAME_SIZE];
+ char desc[CLAP_DESC_SIZE];
};
-struct clap_plugin_params
-{
- /* Returns the number of parameters.
- * [audio-thread] */
- int32_t (*count)(struct clap_plugin *plugin);
-
- /* Copies the parameter's info to param and returns true.
- * If index is greater or equal to the number then return false.
- * [audio-thread] */
- bool (*get_param)(struct clap_plugin *plugin,
- int32_t index,
- struct clap_param *param);
-
- /* Copies the module's info to module and returns true.
- * If module_id is NULL or invalid then return false.
- * [audio-thread] */
- bool (*get_module)(struct clap_plugin *plugin,
- const char *module_id,
- struct clap_param_module *module);
-
- /* Use an audio buffer to automate a parameter at sample rate.
- * Once a parameter is automated by an audio buffer, concurrent
- * automation event shall be ignored in favor of the audio rate
- * automation.
- *
- * To disconnect the automation, set buffer to NULL.
- * [audio-thread] */
- bool (*set_param_port)(struct clap_plugin *plugin,
- int32_t param_index,
- int32_t channel,
- int32_t note,
- struct clap_audio_port *port);
+struct clap_plugin_params {
+ /* Returns the number of parameters.
+ * [main-thread] */
+ int32_t (*count)(struct clap_plugin *plugin);
+
+ /* Copies the parameter's info to param and returns true.
+ * If index is greater or equal to the number then return false.
+ * [main-thread] */
+ bool (*get_param)(struct clap_plugin *plugin,
+ int32_t index,
+ struct clap_param * param);
+
+ /* Copies the module's info to module and returns true on success.
+ * [main-thread] */
+ bool (*get_module)(struct clap_plugin * plugin,
+ const char * module_id,
+ struct clap_param_module *module);
+
+ // [thread-safe,lock-free]
+ double (*plain_to_normalized)(struct clap_plugin *plugin,
+ int32_t index,
+ double plain_value);
+ double (*normalized_to_plain)(struct clap_plugin *plugin,
+ int32_t index,
+ double normalized_value);
+
+ // Sets the parameter value.
+ // 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_parameter_value)(struct clap_plugin * plugin,
+ int32_t index,
+ union clap_param_value plain_value);
};
-struct clap_host_params
-{
- /* [thread-safe] */
- void (*touch_begin)(struct clap_host *host,
- struct clap_plugin *plugin,
- int32_t index);
-
- /* [thread-safe] */
- void (*touch_end)(struct clap_host *host,
- struct clap_plugin *plugin,
- int32_t index);
-
- /* [thread-safe] */
- void (*changed)(struct clap_host *host,
- struct clap_plugin *plugin,
- int32_t index,
- union clap_param_value value,
- bool is_recordable);
-
- /* [thread-safe] */
- void (*rescan)(struct clap_host *host,
- struct clap_plugin *plugin);
+struct clap_host_params {
+ /* [main-thread] */
+ void (*touch_begin)(struct clap_host * host,
+ struct clap_plugin *plugin,
+ int32_t index);
+
+ /* [main-thread] */
+ void (*touch_end)(struct clap_host * host,
+ struct clap_plugin *plugin,
+ int32_t index);
+
+ // If the plugin is activated, the host must send a parameter update
+ // in the next process call to update the audio processor.
+ // Only for value changes that happens in the gui.
+ // [main-thread]
+ void (*changed)(struct clap_host * host,
+ struct clap_plugin * plugin,
+ int32_t index,
+ union clap_param_value plain_value,
+ bool is_recordable);
+
+ /* [main-thread] */
+ void (*rescan)(struct clap_host *host, struct clap_plugin *plugin);
};
#ifdef __cplusplus
}
-#endif
-
-#endif /* !CLAP_EXT_PARAMS_H */
+#endif
+\ No newline at end of file
diff --git a/include/clap/ext/render.h b/include/clap/ext/render.h
@@ -16,24 +16,12 @@ enum clap_plugin_render_mode {
CLAP_RENDER_OFFLINE = 1,
};
-/* The render extension is used to have different quality settings while
- * playing realtime and while rendering. This feature is useful if your
- * processor is not fast enough to render at maximum quality in realtime.
- *
- * It should be used with care because, if you do all your equalization
- * with realtime settings and you render with offline settings, then
- * you might not get the sound you expected.
- */
+// The render extension is used to let the plugin know if it has "realtime"
+// pressure to process.
struct clap_plugin_render {
- /* Sets the plugin render mode, while the plugin is deactivated.
- * Returns true on success, false otherwise.
- * On failure the render mode is unchanged.
- * [main-thread] */
- bool (*set_render_mode)(struct clap_plugin *plugin, enum clap_plugin_render_mode mode);
-
- /* Gets the current rendering mode, can be set anytime.
- * [thread-safe,block-free] */
- enum clap_plugin_render_mode (*get_render_mode)(struct clap_plugin *plugin);
+ // [main-thread]
+ void (*set_render_mode)(struct clap_plugin * plugin,
+ enum clap_plugin_render_mode mode);
};
#ifdef __cplusplus
diff --git a/include/clap/ext/stream.h b/include/clap/ext/stream.h
@@ -16,7 +16,9 @@ struct clap_istream {
struct clap_ostream {
/* returns the number of bytes written.
* -1 on error. */
- int64_t (*write)(struct clap_istream *stream, const void *buffer, uint64_t size);
+ int64_t (*write)(struct clap_istream *stream,
+ const void * buffer,
+ uint64_t size);
};
#ifdef __cplusplus