From 2b3e67af7230573a7a0527fe9517f66e698c59ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Frey?= Date: Sat, 14 Dec 2024 14:47:30 +0100 Subject: [PATCH] CLAP: add macro to use MIDI MPE dialect (#443) * CLAP: add macro to use MIDI MPE dialect * Change MIDI MPE as a generic macro --- distrho/DistrhoInfo.hpp | 6 ++++++ distrho/src/DistrhoPluginCLAP.cpp | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/distrho/DistrhoInfo.hpp b/distrho/DistrhoInfo.hpp index 7df2003d..c8b2ae31 100644 --- a/distrho/DistrhoInfo.hpp +++ b/distrho/DistrhoInfo.hpp @@ -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, diff --git a/distrho/src/DistrhoPluginCLAP.cpp b/distrho/src/DistrhoPluginCLAP.cpp index 498957ec..f7e52847 100644 --- a/distrho/src/DistrhoPluginCLAP.cpp +++ b/distrho/src/DistrhoPluginCLAP.cpp @@ -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 // -------------------------------------------------------------------------------------------------------------------- @@ -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 @@ -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