clap

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

commit c0226d7e71dadd0dad8825e920cd119e2934d508
parent de3ce04943ef70d9fd7993a0c0e02b79795f916e
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Fri, 30 Sep 2016 11:57:34 +0200

Bunch of improvements

Diffstat:
Minclude/clap/clap.h | 51++++++++++++++++++++++-----------------------------
Minclude/clap/ext/params.h | 27++++++++++++++++++++++-----
2 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/include/clap/clap.h b/include/clap/clap.h @@ -136,30 +136,30 @@ enum clap_event_type struct clap_event_param { - /* key/voice index */ - int8_t key; - int8_t channel; + /* key/channel index */ + int8_t key; // 0..127 + int8_t channel; // 0..16 /* parameter */ - int32_t index; // parameter index + int32_t index; // parameter index union clap_param_value value; - float increment; // for param ramp + float increment; // for param ramp }; struct clap_event_note { - int8_t key; - int8_t channel; - float pitch; + int8_t key; // 0..127 + int8_t channel; // 0..15 + float pitch; // hertz float velocity; // 0..1 }; struct clap_event_control { - int8_t key; - int8_t channel; - int8_t control; - float value; // 0..1 + int8_t key; // 0..127 + int8_t channel; // 0..15 + int8_t control; // 0..127 + float value; // 0..1 }; struct clap_event_midi @@ -195,9 +195,9 @@ struct clap_event_jump */ struct clap_event_program { - int32_t bank0; - int32_t bank1; - int32_t program; + int32_t bank0; // 0..max + int32_t bank1; // 0..max + int32_t program; // 0..max }; struct clap_event @@ -233,13 +233,14 @@ enum clap_process_status struct clap_process { - /* audio buffers */ + /* number of frame to process */ int32_t frames_count; /* process info */ int64_t steady_time; // the steady time in samples - /* events */ + /* Linked list of events + * The plugin must not modify those events. */ struct clap_event *events; }; @@ -257,16 +258,6 @@ struct clap_host char *buffer, int32_t size); - /* for events generated by the plugin. */ - void (*events)(struct clap_host *host, - struct clap_plugin *plugin, - struct clap_event *events); - - /* The time in samples, this clock is monotonicaly increasing, - * it means that each time you read the value, it must be greater - * or equal to the previous one. */ - const int64_t *steady_time; - /* Log a message through the host. */ void (*log)(struct clap_host *host, struct clap_plugin *plugin, @@ -288,9 +279,11 @@ struct clap_host enum clap_plugin_type { CLAP_PLUGIN_INSTRUMENT = (1 << 0), - CLAP_PLUGIN_EFFECT = (1 << 1), + CLAP_PLUGIN_AUDIO_EFFECT = (1 << 1), CLAP_PLUGIN_EVENT_EFFECT = (1 << 2), // can be seen as midi effect CLAP_PLUGIN_ANALYZER = (1 << 3), + CLAP_PLUGIN_PATCHER = (1 << 4), + CLAP_PLUGIN_STREAMER = (1 << 5), }; struct clap_plugin @@ -317,7 +310,7 @@ struct clap_plugin bool (*activate)(struct clap_plugin *plugin); void (*deactivate)(struct clap_plugin *plugin); - /* process */ + /* process audio, events, ... */ enum clap_process_status (*process)(struct clap_plugin *plugin, struct clap_process *process); diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h @@ -2,6 +2,7 @@ # define CLAP_EXT_PARAMS_H # include "../clap.h" +# include "ports.h" #ifdef __cplusplus extern "C" { @@ -38,14 +39,18 @@ struct clap_param bool is_per_note; bool is_per_channel; bool is_used; // is this parameter used by the patch? - bool is_periodic; + 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 - union clap_param_value value; - union clap_param_value min; - union clap_param_value max; + + /* Can the parameter be automated at sample rate by an audio buffer? */ + bool accepts_audio_buffer; + + 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; + enum clap_param_scale scale; // scaling of the knob in the UI. }; struct clap_param_module @@ -69,6 +74,18 @@ struct clap_plugin_params 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. */ + bool (*set_param_buffer)(struct clap_plugin *plugin, + int32_t param_index, + int32_t channel, + int32_t note, + struct clap_audio_port *port); }; struct clap_host_params