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