Skip to content

Commit

Permalink
CLAP: add macro to use MIDI MPE dialect (#443)
Browse files Browse the repository at this point in the history
* CLAP: add macro to use MIDI MPE dialect

* Change MIDI MPE as a generic macro
  • Loading branch information
jfrey-xx authored Dec 14, 2024
1 parent f962a44 commit 2b3e67a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions distrho/DistrhoInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,12 @@ START_NAMESPACE_DISTRHO
*/
#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1

/**
Whether the plugin uses MIDI MPE for MIDI input and MIDI output.
@note Only CLAP implements this macro at the moment
*/
#define DISTRHO_PLUGIN_MIDI_MPE 0

/**
Whether the plugin wants to change its own parameter inputs.@n
Not all hosts or plugin formats support this,
Expand Down
14 changes: 10 additions & 4 deletions distrho/src/DistrhoPluginCLAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
# define DPF_CLAP_TIMER_INTERVAL 16 /* ~60 fps */
#endif

#if defined(DISTRHO_PLUGIN_MIDI_MPE) && DISTRHO_PLUGIN_MIDI_MPE
# define DPF_CLAP_NOTE_DIALECT CLAP_NOTE_DIALECT_MIDI_MPE
#else
# define DPF_CLAP_NOTE_DIALECT CLAP_NOTE_DIALECT_MIDI
#endif

START_NAMESPACE_DISTRHO

// --------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -2286,8 +2292,8 @@ static bool CLAP_ABI clap_plugin_note_ports_get(const clap_plugin_t*, uint32_t,
{
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
info->id = 0;
info->supported_dialects = CLAP_NOTE_DIALECT_MIDI;
info->preferred_dialect = CLAP_NOTE_DIALECT_MIDI;
info->supported_dialects = DPF_CLAP_NOTE_DIALECT;
info->preferred_dialect = DPF_CLAP_NOTE_DIALECT;
std::strcpy(info->name, "Event/MIDI Input");
return true;
#endif
Expand All @@ -2296,8 +2302,8 @@ static bool CLAP_ABI clap_plugin_note_ports_get(const clap_plugin_t*, uint32_t,
{
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
info->id = 0;
info->supported_dialects = CLAP_NOTE_DIALECT_MIDI;
info->preferred_dialect = CLAP_NOTE_DIALECT_MIDI;
info->supported_dialects = DPF_CLAP_NOTE_DIALECT;
info->preferred_dialect = DPF_CLAP_NOTE_DIALECT;
std::strcpy(info->name, "Event/MIDI Output");
return true;
#endif
Expand Down

0 comments on commit 2b3e67a

Please sign in to comment.