summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfalkTX <falktx@gmail.com>2018-08-04 10:39:45 +0200
committerfalkTX <falktx@gmail.com>2018-08-04 10:39:45 +0200
commitd5c6245dcbeef164d2d767fdeead48d4bc2a0b85 (patch)
tree726ab3a97f70da253b7af3e515524db7d453fdf0
parent0806803aa0cc17c1a34d651d278c2f5c6d56e507 (diff)
Allow sendNote for plugins with MIDI input
-rw-r--r--distrho/DistrhoUI.hpp2
-rw-r--r--distrho/src/DistrhoUI.cpp2
-rw-r--r--distrho/src/DistrhoUIDSSI.cpp8
-rw-r--r--distrho/src/DistrhoUILV2.cpp8
4 files changed, 13 insertions, 7 deletions
diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp
index 7429bdc2..06949932 100644
--- 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
index 5500e394..f180ee2e 100644
--- 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
index 81c6e542..5f23b836 100644
--- 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
index 4344a280..79c7e212 100644
--- 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);