DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit d5c6245dcbeef164d2d767fdeead48d4bc2a0b85
parent 0806803aa0cc17c1a34d651d278c2f5c6d56e507
Author: falkTX <falktx@gmail.com>
Date:   Sat,  4 Aug 2018 10:39:18 +0200

Allow sendNote for plugins with MIDI input

Diffstat:
Mdistrho/DistrhoUI.hpp | 2+-
Mdistrho/src/DistrhoUI.cpp | 2+-
Mdistrho/src/DistrhoUIDSSI.cpp | 8++++++++
Mdistrho/src/DistrhoUILV2.cpp | 8+++-----
4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp @@ -90,7 +90,7 @@ public: void setState(const char* key, const char* value); #endif -#if DISTRHO_PLUGIN_IS_SYNTH +#if DISTRHO_PLUGIN_WANT_MIDI_INPUT /** sendNote. @TODO Document this. diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp @@ -82,7 +82,7 @@ void UI::setState(const char* key, const char* value) } #endif -#if DISTRHO_PLUGIN_IS_SYNTH +#if DISTRHO_PLUGIN_WANT_MIDI_INPUT void UI::sendNote(uint8_t channel, uint8_t note, uint8_t velocity) { pData->sendNoteCallback(channel, note, velocity); diff --git a/distrho/src/DistrhoUIDSSI.cpp b/distrho/src/DistrhoUIDSSI.cpp @@ -26,6 +26,10 @@ START_NAMESPACE_DISTRHO +#if ! DISTRHO_PLUGIN_WANT_MIDI_INPUT +static const sendNoteFunc sendNoteCallback = nullptr; +#endif + // ----------------------------------------------------------------------- struct OscData { @@ -180,6 +184,7 @@ protected: fOscData.send_configure(key, value); } +#if DISTRHO_PLUGIN_WANT_MIDI_INPUT void sendNote(const uint8_t channel, const uint8_t note, const uint8_t velocity) { if (fOscData.server == nullptr) @@ -195,6 +200,7 @@ protected: }; fOscData.send_midi(mdata); } +#endif void setSize(const uint width, const uint height) { @@ -222,10 +228,12 @@ private: uiPtr->setState(key, value); } +#if DISTRHO_PLUGIN_WANT_MIDI_INPUT static void sendNoteCallback(void* ptr, uint8_t channel, uint8_t note, uint8_t velocity) { uiPtr->sendNote(channel, note, velocity); } +#endif static void setSizeCallback(void* ptr, uint width, uint height) { diff --git a/distrho/src/DistrhoUILV2.cpp b/distrho/src/DistrhoUILV2.cpp @@ -34,8 +34,6 @@ # define DISTRHO_PLUGIN_LV2_STATE_PREFIX "urn:distrho:" #endif -#define DISTRHO_LV2_USE_EVENTS_IN (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI)) - START_NAMESPACE_DISTRHO typedef struct _LV2_Atom_MidiEvent { @@ -43,7 +41,7 @@ typedef struct _LV2_Atom_MidiEvent { uint8_t data[3]; /**< MIDI data (body). */ } LV2_Atom_MidiEvent; -#if ! DISTRHO_LV2_USE_EVENTS_IN +#if ! DISTRHO_PLUGIN_WANT_MIDI_INPUT static const sendNoteFunc sendNoteCallback = nullptr; #endif @@ -269,7 +267,7 @@ protected: fWriteFunction(fController, eventInPortIndex, atomSize, fEventTransferURID, atom); } -#if DISTRHO_LV2_USE_EVENTS_IN +#if DISTRHO_PLUGIN_WANT_MIDI_INPUT void sendNote(const uint8_t channel, const uint8_t note, const uint8_t velocity) { DISTRHO_SAFE_ASSERT_RETURN(fWriteFunction != nullptr,); @@ -340,7 +338,7 @@ private: uiPtr->setState(key, value); } -#if DISTRHO_LV2_USE_EVENTS_IN +#if DISTRHO_PLUGIN_WANT_MIDI_INPUT static void sendNoteCallback(void* ptr, uint8_t channel, uint8_t note, uint8_t velocity) { uiPtr->sendNote(channel, note, velocity);