From 4fe80068e16571f10eb6835805faa4e17edc9515 Mon Sep 17 00:00:00 2001 From: Bremmers Date: Thu, 12 Oct 2023 14:31:47 +0200 Subject: [PATCH 1/2] note expressions extension --- include/clap/ext/draft/note-expressions.h | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 include/clap/ext/draft/note-expressions.h diff --git a/include/clap/ext/draft/note-expressions.h b/include/clap/ext/draft/note-expressions.h new file mode 100644 index 00000000..883b0889 --- /dev/null +++ b/include/clap/ext/draft/note-expressions.h @@ -0,0 +1,53 @@ +#pragma once + +#include "../../plugin.h" + +// This extension reports which note expressions are supported by a plugin. +// If this extension isn't present all note expressions are assumed to be supported. + +// TODO : is the clap_supported_note_expressions bitmask future-proof? Or should it be a "count / get-info" pattern? +// TODO : does getNumMIDIChannels still make sense in a 'real' extension? It can probably removed if we go for a "count / get-info" pattern? + +static CLAP_CONSTEXPR const char CLAP_EXT_NOTE_EXPRESSIONS[] = "clap.note-expressions.draft/0"; + +#ifdef __cplusplus +extern "C" { +#endif + +enum clap_supported_note_expressions +{ + CLAP_NOTE_EXPRESSION_MASK_VOLUME = 1 << 0, + CLAP_NOTE_EXPRESSION_MASK_PAN = 1 << 1, + CLAP_NOTE_EXPRESSION_MASK_TUNING = 1 << 2, + CLAP_NOTE_EXPRESSION_MASK_VIBRATO = 1 << 3, + CLAP_NOTE_EXPRESSION_MASK_EXPRESSION = 1 << 4, + CLAP_NOTE_EXPRESSION_MASK_BRIGHTNESS = 1 << 5, + CLAP_NOTE_EXPRESSION_MASK_PRESSURE = 1 << 6, + + CLAP_NOTE_EXPRESSION_MASK_ALL = (1<<7)-1 // just the and of the above +}; + +/* + retrieve additional information for the plugin itself, if note expressions are being supported and if there + is a limit in MIDI channels (to reduce the offered controllers etc. in the host) +*/ +typedef struct clap_plugin_note_expressions +{ + // [main-thread] + uint32_t(CLAP_ABI* getNumMIDIChannels) (const clap_plugin* plugin, int16_t port_index); // return 1-16 + + // [main-thread] + uint32_t(CLAP_ABI* supportedNoteExpressions) (const clap_plugin* plugin, int16_t port_index, int16_t channel); // returns a bitmap of clap_supported_note_expressions +} clap_plugin_note_expressions_t; + + +typedef struct clap_host_note_expressions { + // port_index = -1 means 'all ports' + // [main-thread] + void(CLAP_ABI *changed)(const clap_host_t *host, + int16_t port_index); +} clap_host_note_expressions_t; + +#ifdef __cplusplus +} +#endif \ No newline at end of file From cdfc77a61ba5277903464321f8188e173707e97b Mon Sep 17 00:00:00 2001 From: Bremmers Date: Fri, 13 Oct 2023 10:12:18 +0200 Subject: [PATCH 2/2] removed getNumMIDIChannels --- include/clap/ext/draft/note-expressions.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/clap/ext/draft/note-expressions.h b/include/clap/ext/draft/note-expressions.h index 883b0889..839e8903 100644 --- a/include/clap/ext/draft/note-expressions.h +++ b/include/clap/ext/draft/note-expressions.h @@ -6,7 +6,6 @@ // If this extension isn't present all note expressions are assumed to be supported. // TODO : is the clap_supported_note_expressions bitmask future-proof? Or should it be a "count / get-info" pattern? -// TODO : does getNumMIDIChannels still make sense in a 'real' extension? It can probably removed if we go for a "count / get-info" pattern? static CLAP_CONSTEXPR const char CLAP_EXT_NOTE_EXPRESSIONS[] = "clap.note-expressions.draft/0"; @@ -33,9 +32,6 @@ enum clap_supported_note_expressions */ typedef struct clap_plugin_note_expressions { - // [main-thread] - uint32_t(CLAP_ABI* getNumMIDIChannels) (const clap_plugin* plugin, int16_t port_index); // return 1-16 - // [main-thread] uint32_t(CLAP_ABI* supportedNoteExpressions) (const clap_plugin* plugin, int16_t port_index, int16_t channel); // returns a bitmap of clap_supported_note_expressions } clap_plugin_note_expressions_t;