Skip to content

Commit

Permalink
note expressions extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Bremmers authored Oct 12, 2023
1 parent ac69248 commit 4fe8006
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions include/clap/ext/draft/note-expressions.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4fe8006

Please sign in to comment.