From 4ee6a834c7e6de20510d37f653830b15ae25157b Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 8 Jan 2015 20:12:13 +0000 Subject: [PATCH] Make liblo optional --- Makefile | 27 ++-- source/Makefile.mk | 12 +- source/backend/CarlaStandalone.cpp | 21 +++- source/backend/engine/CarlaEngine.cpp | 14 ++- source/backend/engine/CarlaEngineInternal.cpp | 16 ++- source/backend/engine/CarlaEngineInternal.hpp | 8 +- source/backend/engine/CarlaEngineNative.cpp | 2 + source/backend/engine/CarlaEngineOsc.cpp | 4 + source/backend/engine/CarlaEngineOsc.hpp | 4 + source/backend/engine/CarlaEngineOscSend.cpp | 4 + source/backend/engine/CarlaEngineThread.cpp | 10 +- source/backend/plugin/CarlaPlugin.cpp | 117 +++++++++++------- source/backend/plugin/CarlaPluginDSSI.cpp | 42 ++++++- source/backend/plugin/CarlaPluginInternal.cpp | 6 +- source/backend/plugin/CarlaPluginInternal.hpp | 1 - source/backend/plugin/CarlaPluginLV2.cpp | 2 +- source/backend/plugin/CarlaPluginNative.cpp | 2 +- source/backend/plugin/CarlaPluginVST2.cpp | 8 +- source/native-plugins/distrho-3bandeq.cpp | 4 + .../native-plugins/distrho-3bandsplitter.cpp | 4 + source/native-plugins/distrho-mverb.cpp | 4 + source/native-plugins/distrho-nekobi.cpp | 4 + source/native-plugins/distrho-pingpongpan.cpp | 4 + 23 files changed, 233 insertions(+), 87 deletions(-) diff --git a/Makefile b/Makefile index cfad1bbd5..8e18cc653 100644 --- a/Makefile +++ b/Makefile @@ -250,6 +250,7 @@ wine64: # ---------------------------------------------------------------------------------------------------------------------------- # Resources +ifeq ($(HAVE_PYQT),true) RES = \ bin/resources/carla_app.py \ bin/resources/carla_backend.py \ @@ -310,10 +311,14 @@ source/resources_rc.py: resources/resources.qrc resources/*/*.png resources/*/*. bin/resources/%.py: source/%.py $(LINK) $(CURDIR)/source/$*.py bin/resources/ +else +RES: +endif # ---------------------------------------------------------------------------------------------------------------------------- # UI code +ifeq ($(HAVE_PYQT),true) UIs = \ source/ui_carla_control.py \ source/ui_carla_about.py \ @@ -338,6 +343,9 @@ UI: $(UIs) source/ui_%.py: resources/ui/%.ui $(PYUIC) $< -o $@ +else +UI: +endif # ---------------------------------------------------------------------------------------------------------------------------- # Widgets @@ -785,20 +793,25 @@ endif @echo "$(tS)---> Internal plugins: $(tE)" ifneq ($(WIN32),true) - @echo "Carla-Patchbay:$(ANS_YES)" - @echo "Carla-Rack: $(ANS_YES)" + @echo "Carla-Patchbay: $(ANS_YES)" + @echo "Carla-Rack: $(ANS_YES)" +else + @echo "Carla-Patchbay: $(ANS_NO) $(mS)Not available for Windows$(mE)" + @echo "Carla-Rack: $(ANS_NO) $(mS)Not available for Windows$(mE)" +endif +ifeq ($(HAVE_DGL),true) + @echo "DISTRHO Plugins:$(ANS_YES) (with UI)" else - @echo "Carla-Patchbay:$(ANS_NO) $(mS)Not available for Windows$(mE)" - @echo "Carla-Rack: $(ANS_NO) $(mS)Not available for Windows$(mE)" + @echo "DISTRHO Plugins:$(ANS_YES) (without UI)" endif ifeq ($(HAVE_ZYN_DEPS),true) ifeq ($(HAVE_ZYN_UI_DEPS),true) - @echo "ZynAddSubFX: $(ANS_YES) (with UI)" + @echo "ZynAddSubFX: $(ANS_YES) (with UI)" else - @echo "ZynAddSubFX: $(ANS_YES) (without UI) $(mS)NTK missing$(mE)" + @echo "ZynAddSubFX: $(ANS_YES) (without UI) $(mS)NTK missing$(mE)" endif else - @echo "ZynAddSubFX: $(ANS_NO) $(mS)fftw3, mxml or zlib missing$(mE)" + @echo "ZynAddSubFX: $(ANS_NO) $(mS)fftw3, mxml or zlib missing$(mE)" endif # ---------------------------------------------------------------------------------------------------------------------------- diff --git a/source/Makefile.mk b/source/Makefile.mk index 5cb6572c6..7a0962b3d 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -145,10 +145,6 @@ endif # -------------------------------------------------------------- # Check for required libs -ifneq ($(shell pkg-config --exists liblo && echo true),true) -$(error liblo missing, cannot continue) -endif - ifeq ($(LINUX),true) ifeq (,$(wildcard /usr/include/magic.h)) $(error libmagic missing, cannot continue) @@ -173,6 +169,8 @@ endif HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true) HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true) + +HAVE_LIBLO = $(shell pkg-config --exists liblo && echo true) HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true) HAVE_LINUXSAMPLER = $(shell pkg-config --atleast-version=1.0.0.svn41 linuxsampler && echo true) @@ -262,6 +260,10 @@ ifeq ($(HAVE_DGL),true) BASE_FLAGS += -DHAVE_DGL endif +ifeq ($(HAVE_LIBLO),true) +BASE_FLAGS += -DHAVE_LIBLO +endif + ifeq ($(HAVE_FLUIDSYNTH),true) BASE_FLAGS += -DHAVE_FLUIDSYNTH endif @@ -281,8 +283,10 @@ endif # -------------------------------------------------------------- # Set libs stuff (part 1) +ifeq ($(HAVE_LIBLO),true) LIBLO_FLAGS = $(shell pkg-config --cflags liblo) LIBLO_LIBS = $(shell pkg-config --libs liblo) +endif ifeq ($(HAVE_FLUIDSYNTH),true) FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth) diff --git a/source/backend/CarlaStandalone.cpp b/source/backend/CarlaStandalone.cpp index 094289c02..17009a75c 100644 --- a/source/backend/CarlaStandalone.cpp +++ b/source/backend/CarlaStandalone.cpp @@ -26,7 +26,10 @@ #include "CarlaBackendUtils.hpp" #include "CarlaBase64Utils.hpp" -#include "CarlaOscUtils.hpp" + +#ifdef HAVE_LIBLO +# include "CarlaOscUtils.hpp" +#endif #include "juce_audio_formats.h" @@ -79,6 +82,7 @@ struct CarlaBackendStandalone { static CarlaBackendStandalone gStandalone; +#ifdef HAVE_LIBLO // ------------------------------------------------------------------------------------------------------------------- // NSM support @@ -345,6 +349,8 @@ private: static CarlaNSM gNSM; +#endif // HAVE_LIBLO + // ------------------------------------------------------------------------------------------------------------------- // API @@ -679,7 +685,9 @@ void carla_engine_idle() { CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,); +#ifdef HAVE_LIBLO gNSM.idle(); +#endif gStandalone.engine->idle(); } @@ -788,8 +796,9 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt case CB:: ENGINE_OPTION_NSM_INIT: CARLA_SAFE_ASSERT_RETURN(value != 0,); CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); - +#ifdef HAVE_LIBLO gNSM.announce(value, valueStr); +#endif break; case CB::ENGINE_OPTION_PLUGIN_PATH: @@ -2153,6 +2162,7 @@ const char* carla_get_host_osc_url_tcp() { carla_debug("carla_get_host_osc_url_tcp()"); +#ifdef HAVE_LIBLO if (gStandalone.engine == nullptr) { carla_stderr2("Engine is not running"); @@ -2161,12 +2171,16 @@ const char* carla_get_host_osc_url_tcp() } return gStandalone.engine->getOscServerPathTCP(); +#else + return nullptr; +#endif } const char* carla_get_host_osc_url_udp() { carla_debug("carla_get_host_osc_url_udp()"); +#ifdef HAVE_LIBLO if (gStandalone.engine == nullptr) { carla_stderr2("Engine is not running"); @@ -2175,6 +2189,9 @@ const char* carla_get_host_osc_url_udp() } return gStandalone.engine->getOscServerPathUDP(); +#else + return nullptr; +#endif } // ------------------------------------------------------------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 8c1e028b8..ea0eeb89e 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -270,7 +270,7 @@ bool CarlaEngine::close() removeAllPlugins(); } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) if (pData->osc.isControlRegistered()) oscSend_control_exit(); #endif @@ -303,7 +303,9 @@ void CarlaEngine::idle() noexcept } } +#ifdef HAVE_LIBLO pData->osc.idle(); +#endif } CarlaEngineClient* CarlaEngine::addClient(CarlaPlugin* const) @@ -521,7 +523,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons if (plugin == nullptr) return false; -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) plugin->registerToOscClient(); #endif @@ -611,8 +613,10 @@ bool CarlaEngine::removePlugin(const uint id) } */ +# ifdef HAVE_LIBLO if (isOscControlRegistered()) oscSend_control_remove_plugin(id); +# endif #else pData->curPluginCount = 0; carla_zeroStruct(pData->plugins, 1); @@ -1397,15 +1401,16 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch } } +#ifdef HAVE_LIBLO // ----------------------------------------------------------------------- // OSC Stuff -#ifndef BUILD_BRIDGE +# ifndef BUILD_BRIDGE bool CarlaEngine::isOscControlRegistered() const noexcept { return pData->osc.isControlRegistered(); } -#endif +# endif void CarlaEngine::idleOsc() const noexcept { @@ -1421,6 +1426,7 @@ const char* CarlaEngine::getOscServerPathUDP() const noexcept { return pData->osc.getServerPathUDP(); } +#endif // ----------------------------------------------------------------------- // Helper functions diff --git a/source/backend/engine/CarlaEngineInternal.cpp b/source/backend/engine/CarlaEngineInternal.cpp index ac6ebea3a..f109550f0 100644 --- a/source/backend/engine/CarlaEngineInternal.cpp +++ b/source/backend/engine/CarlaEngineInternal.cpp @@ -94,9 +94,11 @@ void EngineNextAction::clearAndReset() noexcept // CarlaEngine::ProtectedData CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept - : osc(engine), - thread(engine), + : thread(engine), +#ifdef HAVE_LIBLO + osc(engine), oscData(nullptr), +#endif callback(nullptr), callbackPtr(nullptr), fileCallback(nullptr), @@ -145,7 +147,9 @@ CarlaEngine::ProtectedData::~ProtectedData() noexcept bool CarlaEngine::ProtectedData::init(const char* const clientName) { CARLA_SAFE_ASSERT_RETURN_INTERNAL_ERR(name.isEmpty(), "Invalid engine internal data (err #1)"); +#ifdef HAVE_LIBLO CARLA_SAFE_ASSERT_RETURN_INTERNAL_ERR(oscData == nullptr, "Invalid engine internal data (err #2)"); +#endif CARLA_SAFE_ASSERT_RETURN_INTERNAL_ERR(events.in == nullptr, "Invalid engine internal data (err #4)"); CARLA_SAFE_ASSERT_RETURN_INTERNAL_ERR(events.out == nullptr, "Invalid engine internal data (err #5)"); CARLA_SAFE_ASSERT_RETURN_INTERNAL_ERR(clientName != nullptr && clientName[0] != '\0', "Invalid client name"); @@ -193,10 +197,14 @@ bool CarlaEngine::ProtectedData::init(const char* const clientName) timeInfo.clear(); +#ifdef HAVE_LIBLO osc.init(clientName); +# ifndef BUILD_BRIDGE + oscData = osc.getControlData(); +# endif +#endif #ifndef BUILD_BRIDGE - oscData = osc.getControlData(); plugins = new EnginePluginData[maxPluginNumber]; carla_zeroStruct(plugins, maxPluginNumber); #endif @@ -219,8 +227,10 @@ void CarlaEngine::ProtectedData::close() thread.stopThread(500); nextAction.ready(); +#ifdef HAVE_LIBLO osc.close(); oscData = nullptr; +#endif aboutToClose = false; curPluginCount = 0; diff --git a/source/backend/engine/CarlaEngineInternal.hpp b/source/backend/engine/CarlaEngineInternal.hpp index e7609793d..bcb9d7c3b 100644 --- a/source/backend/engine/CarlaEngineInternal.hpp +++ b/source/backend/engine/CarlaEngineInternal.hpp @@ -150,13 +150,15 @@ struct EnginePluginData { // CarlaEngineProtectedData struct CarlaEngine::ProtectedData { - CarlaEngineOsc osc; CarlaEngineThread thread; -#ifdef BUILD_BRIDGE +#ifdef HAVE_LIBLO + CarlaEngineOsc osc; +# ifdef BUILD_BRIDGE CarlaOscData* oscData; -#else +# else const CarlaOscData* oscData; +# endif #endif EngineCallbackFunc callback; diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index f0de778ba..046a2ab69 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -1467,7 +1467,9 @@ protected: } } +#ifdef HAVE_LIBLO pData->osc.idle(); +#endif fUiServer.idlePipe(); diff --git a/source/backend/engine/CarlaEngineOsc.cpp b/source/backend/engine/CarlaEngineOsc.cpp index cc50d3ef7..ae74145b0 100644 --- a/source/backend/engine/CarlaEngineOsc.cpp +++ b/source/backend/engine/CarlaEngineOsc.cpp @@ -15,6 +15,8 @@ * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ +#ifdef HAVE_LIBLO + #include "CarlaEngine.hpp" #include "CarlaEngineOsc.hpp" #include "CarlaPlugin.hpp" @@ -541,3 +543,5 @@ int CarlaEngineOsc::handleMsgNoteOff(CARLA_ENGINE_OSC_HANDLE_ARGS) // ----------------------------------------------------------------------- CARLA_BACKEND_END_NAMESPACE + +#endif // HAVE_LIBLO diff --git a/source/backend/engine/CarlaEngineOsc.hpp b/source/backend/engine/CarlaEngineOsc.hpp index 10d993f48..d3e97f61a 100644 --- a/source/backend/engine/CarlaEngineOsc.hpp +++ b/source/backend/engine/CarlaEngineOsc.hpp @@ -18,6 +18,8 @@ #ifndef CARLA_ENGINE_OSC_HPP_INCLUDED #define CARLA_ENGINE_OSC_HPP_INCLUDED +#ifdef HAVE_LIBLO + #include "CarlaBackend.h" #include "CarlaOscUtils.hpp" #include "CarlaString.hpp" @@ -156,4 +158,6 @@ private: CARLA_BACKEND_END_NAMESPACE +#endif // HAVE_LIBLO + #endif // CARLA_ENGINE_OSC_HPP_INCLUDED diff --git a/source/backend/engine/CarlaEngineOscSend.cpp b/source/backend/engine/CarlaEngineOscSend.cpp index 9a5164985..4fd6a26a4 100644 --- a/source/backend/engine/CarlaEngineOscSend.cpp +++ b/source/backend/engine/CarlaEngineOscSend.cpp @@ -15,6 +15,8 @@ * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ +#ifdef HAVE_LIBLO + #include "CarlaBackendUtils.hpp" #include "CarlaEngineInternal.hpp" #include "CarlaMIDI.h" @@ -401,3 +403,5 @@ void CarlaEngine::oscSend_control_exit() const noexcept // ----------------------------------------------------------------------- CARLA_BACKEND_END_NAMESPACE + +#endif // HAVE_LIBLO diff --git a/source/backend/engine/CarlaEngineThread.cpp b/source/backend/engine/CarlaEngineThread.cpp index 0b64dc7fb..73323c5df 100644 --- a/source/backend/engine/CarlaEngineThread.cpp +++ b/source/backend/engine/CarlaEngineThread.cpp @@ -51,12 +51,14 @@ void CarlaEngineThread::run() noexcept #ifdef BUILD_BRIDGE for (; /*kEngine->isRunning() &&*/ ! shouldThreadExit();) - { - const bool oscRegisted = false; #else for (; kEngine->isRunning() && ! shouldThreadExit();) +#endif { +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) const bool oscRegisted = kEngine->isOscControlRegistered(); +#else + const bool oscRegisted = false; #endif for (uint i=0, count = kEngine->getCurrentPluginCount(); i < count; ++i) @@ -91,7 +93,7 @@ void CarlaEngineThread::run() noexcept value = plugin->getParameterValue(j); -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC engine client if (oscRegisted) kEngine->oscSend_control_set_parameter_value(i, static_cast(j), value); @@ -109,7 +111,7 @@ void CarlaEngineThread::run() noexcept } } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // ----------------------------------------------------------- // Update OSC control client peaks diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 2950765e6..c2d2b618c 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -966,15 +966,17 @@ void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool se #ifndef BUILD_BRIDGE const float value(active ? 1.0f : 0.0f); +# ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_ACTIVE, value); +# endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_ACTIVE, 0, value, nullptr); -#else - // unused - return; (void)sendOsc; (void)sendCallback; #endif + + // may be unused + return; (void)sendOsc; (void)sendCallback; } #ifndef BUILD_BRIDGE @@ -989,11 +991,16 @@ void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool se pData->postProc.dryWet = fixedValue; +#ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_DRYWET, fixedValue); +#endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_DRYWET, 0, fixedValue, nullptr); + + // may be unused + return; (void)sendOsc; } void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool sendCallback) noexcept @@ -1007,11 +1014,16 @@ void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool se pData->postProc.volume = fixedValue; +#ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_VOLUME, fixedValue); +#endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_VOLUME, 0, fixedValue, nullptr); + + // may be unused + return; (void)sendOsc; } void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bool sendCallback) noexcept @@ -1025,11 +1037,16 @@ void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bo pData->postProc.balanceLeft = fixedValue; +#ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_BALANCE_LEFT, fixedValue); +#endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_BALANCE_LEFT, 0, fixedValue, nullptr); + + // may be unused + return; (void)sendOsc; } void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const bool sendCallback) noexcept @@ -1043,11 +1060,16 @@ void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const b pData->postProc.balanceRight = fixedValue; +#ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_BALANCE_RIGHT, fixedValue); +#endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_BALANCE_RIGHT, 0, fixedValue, nullptr); + + // may be unused + return; (void)sendOsc; } void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool sendCallback) noexcept @@ -1061,13 +1083,18 @@ void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool s pData->postProc.panning = fixedValue; +#ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_PANNING, fixedValue); +#endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_PANNING, 0, fixedValue, nullptr); + + // may be unused + return; (void)sendOsc; } -#endif +#endif // ! BUILD_BRIDGE void CarlaPlugin::setCtrlChannel(const int8_t channel, const bool sendOsc, const bool sendCallback) noexcept { @@ -1084,15 +1111,17 @@ void CarlaPlugin::setCtrlChannel(const int8_t channel, const bool sendOsc, const #ifndef BUILD_BRIDGE const float channelf(channel); +# ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_CTRL_CHANNEL, channelf); +# endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_CTRL_CHANNEL, 0, channelf, nullptr); -#else - // unused - return; (void)sendOsc; (void)sendCallback; #endif + + // may be unused + return; (void)sendOsc; (void)sendCallback; } // ------------------------------------------------------------------- @@ -1106,17 +1135,17 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu uiParameterChange(parameterId, value); #ifndef BUILD_BRIDGE +# ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast(parameterId), value); -#endif +# endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast(parameterId), 0, value, nullptr); - -#ifdef BUILD_BRIDGE - // unused - return; (void)sendOsc; #endif + + // may be unused + return; (void)sendOsc; (void)sendCallback; } void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept @@ -1166,15 +1195,17 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, const uint pData->param.data[parameterId].midiChannel = channel; #ifndef BUILD_BRIDGE +# ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_midi_channel(pData->id, parameterId, channel); +# endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, pData->id, static_cast(parameterId), channel, 0.0f, nullptr); -#else - // unused - return; (void)sendOsc; (void)sendCallback; #endif + + // may be unused + return; (void)sendOsc; (void)sendCallback; } void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, const int16_t cc, const bool sendOsc, const bool sendCallback) noexcept @@ -1188,15 +1219,17 @@ void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, const int16_t c pData->param.data[parameterId].midiCC = cc; #ifndef BUILD_BRIDGE +# ifdef HAVE_LIBLO if (sendOsc && pData->engine->isOscControlRegistered()) pData->engine->oscSend_control_set_parameter_midi_cc(pData->id, parameterId, cc); +# endif if (sendCallback) pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED, pData->id, static_cast(parameterId), cc, 0.0f, nullptr); -#else - // unused - return; (void)sendOsc; (void)sendCallback; #endif + + // may be unused + return; (void)sendOsc; (void)sendCallback; } void CarlaPlugin::setCustomData(const char* const type, const char* const key, const char* const value, const bool) @@ -1249,13 +1282,13 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool pData->prog.current = index; -#ifdef BUILD_BRIDGE - const bool reallySendOsc(false); -#else +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) const bool reallySendOsc(sendOsc && pData->engine->isOscControlRegistered()); if (reallySendOsc) pData->engine->oscSend_control_set_current_program(pData->id, index); +#else + const bool reallySendOsc(false); #endif if (sendCallback) @@ -1273,10 +1306,8 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool pData->updateParameterValues(this, reallySendOsc, sendCallback, true); } -#ifdef BUILD_BRIDGE - // unused + // may be unused return; (void)sendGui; (void)sendOsc; -#endif } void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept @@ -1285,13 +1316,13 @@ void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const pData->midiprog.current = index; -#ifdef BUILD_BRIDGE - const bool reallySendOsc(false); -#else +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) const bool reallySendOsc(sendOsc && pData->engine->isOscControlRegistered()); if (reallySendOsc) pData->engine->oscSend_control_set_current_midi_program(pData->id, index); +#else + const bool reallySendOsc(false); #endif if (sendCallback) @@ -1308,10 +1339,8 @@ void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const pData->updateParameterValues(this, reallySendOsc, sendCallback, true); } -#ifdef BUILD_BRIDGE - // unused + // may be unused return; (void)sendGui; (void)sendOsc; -#endif } void CarlaPlugin::setMidiProgramById(const uint32_t bank, const uint32_t program, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept @@ -1365,7 +1394,7 @@ void CarlaPlugin::idle() const bool hasUI(pData->hints & PLUGIN_HAS_CUSTOM_UI); const bool needsUiMainThread(pData->hints & PLUGIN_NEEDS_UI_MAIN_THREAD); -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) const bool sendOsc(pData->engine->isOscControlRegistered()); #endif @@ -1397,7 +1426,7 @@ void CarlaPlugin::idle() if (event.value2 != 1) { -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC control client if (sendOsc) pData->engine->oscSend_control_set_parameter_value(pData->id, event.value1, event.value3); @@ -1423,7 +1452,7 @@ void CarlaPlugin::idle() const float paramDefault(pData->param.ranges[j].def); const float paramValue(getParameterValue(j)); -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) if (sendOsc) { pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast(j), paramValue); @@ -1434,7 +1463,7 @@ void CarlaPlugin::idle() pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, static_cast(j), 0, paramDefault, nullptr); } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC control client if (sendOsc) pData->engine->oscSend_control_set_current_program(pData->id, event.value1); @@ -1460,7 +1489,7 @@ void CarlaPlugin::idle() const float paramDefault(pData->param.ranges[j].def); const float paramValue(getParameterValue(j)); -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) if (sendOsc) { pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast(j), paramValue); @@ -1471,7 +1500,7 @@ void CarlaPlugin::idle() pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, static_cast(j), 0, paramDefault, nullptr); } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC control client if (sendOsc) pData->engine->oscSend_control_set_current_midi_program(pData->id, event.value1); @@ -1499,7 +1528,7 @@ void CarlaPlugin::idle() uiNoteOn(channel, note, velocity); } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC control client if (sendOsc) pData->engine->oscSend_control_note_on(pData->id, channel, note, velocity); @@ -1525,7 +1554,7 @@ void CarlaPlugin::idle() uiNoteOff(channel, note); } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC control client if (sendOsc) pData->engine->oscSend_control_note_off(pData->id, channel, note); @@ -1573,10 +1602,10 @@ void CarlaPlugin::clearBuffers() noexcept pData->clearBuffers(); } +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // ------------------------------------------------------------------- // OSC stuff -#ifndef BUILD_BRIDGE void CarlaPlugin::registerToOscClient() noexcept { if (! pData->engine->isOscControlRegistered()) @@ -1675,12 +1704,14 @@ void CarlaPlugin::registerToOscClient() noexcept pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_ACTIVE, pData->active ? 1.0f : 0.0f); } } -#endif // BUILD_BRIDGE +#endif +// FIXME void CarlaPlugin::handleOscMessage(const char* const, const int, const void* const, const char* const, const lo_message) { // do nothing } +//#endif // HAVE_LIBLO && ! BUILD_BRIDGE // ------------------------------------------------------------------- // MIDI events @@ -1709,7 +1740,7 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note, uiNoteOff(channel, note); } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) if (sendOsc && pData->engine->isOscControlRegistered()) { if (velo > 0) @@ -1722,10 +1753,8 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note, if (sendCallback) pData->engine->callback((velo > 0) ? ENGINE_CALLBACK_NOTE_ON : ENGINE_CALLBACK_NOTE_OFF, pData->id, channel, note, velo, nullptr); -#ifdef BUILD_BRIDGE - // unused + // may be unused return; (void)sendOsc; -#endif } #ifndef BUILD_BRIDGE diff --git a/source/backend/plugin/CarlaPluginDSSI.cpp b/source/backend/plugin/CarlaPluginDSSI.cpp index 24d9c3756..6159b8ddc 100644 --- a/source/backend/plugin/CarlaPluginDSSI.cpp +++ b/source/backend/plugin/CarlaPluginDSSI.cpp @@ -23,7 +23,11 @@ #include "CarlaDssiUtils.hpp" #include "CarlaMathUtils.hpp" -#include "CarlaThread.hpp" + +#ifdef HAVE_LIBLO +# include "CarlaOscUtils.hpp" +# include "CarlaThread.hpp" +#endif using juce::ChildProcess; using juce::ScopedPointer; @@ -60,6 +64,7 @@ CARLA_BACKEND_START_NAMESPACE static const CustomData kCustomDataFallback = { nullptr, nullptr, nullptr }; +#ifdef HAVE_LIBLO // ------------------------------------------------------------------- class CarlaThreadDSSIUI : public CarlaThread @@ -241,6 +246,7 @@ private: CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaThreadDSSIUI) }; +#endif // ----------------------------------------------------- @@ -254,14 +260,18 @@ public: fDescriptor(nullptr), fDssiDescriptor(nullptr), fUsesCustomData(false), +#ifdef HAVE_LIBLO fUiFilename(nullptr), +#endif fAudioInBuffers(nullptr), fAudioOutBuffers(nullptr), fParamBuffers(nullptr), fLatencyChanged(false), fLatencyIndex(-1), +#ifdef HAVE_LIBLO fOscData(), fThreadUI(engine, this, fOscData), +#endif leakDetector_CarlaPluginDSSI() { carla_debug("CarlaPluginDSSI::CarlaPluginDSSI(%p, %i)", engine, id); @@ -271,6 +281,7 @@ public: { carla_debug("CarlaPluginDSSI::~CarlaPluginDSSI()"); +#ifdef HAVE_LIBLO // close UI if (pData->hints & PLUGIN_HAS_CUSTOM_UI) { @@ -278,6 +289,7 @@ public: fThreadUI.stopThread(static_cast(pData->engine->getOptions().uiBridgesTimeout * 2)); } +#endif pData->singleMutex.lock(); pData->masterMutex.lock(); @@ -319,11 +331,13 @@ public: fDssiDescriptor = nullptr; } +#ifdef HAVE_LIBLO if (fUiFilename != nullptr) { delete[] fUiFilename; fUiFilename = nullptr; } +#endif clearBuffers(); } @@ -557,8 +571,10 @@ public: } } +#ifdef HAVE_LIBLO if (sendGui && fOscData.target != nullptr) osc_send_configure(fOscData, key, value); +#endif if (std::strcmp(key, "reloadprograms") == 0 || std::strcmp(key, "load") == 0 || std::strncmp(key, "patches", 7) == 0) { @@ -588,10 +604,10 @@ public: } CARLA_SAFE_EXCEPTION("CarlaPluginDSSI::setChunkData"); } -#ifdef BUILD_BRIDGE - const bool sendOsc(false); -#else +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) const bool sendOsc(pData->engine->isOscControlRegistered()); +#else + const bool sendOsc(false); #endif pData->updateParameterValues(this, sendOsc, true, false); } @@ -625,6 +641,7 @@ public: CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); } +#ifdef HAVE_LIBLO // ------------------------------------------------------------------- // Set ui stuff @@ -649,6 +666,7 @@ public: fThreadUI.stopThread(static_cast(pData->engine->getOptions().uiBridgesTimeout * 2)); } } +#endif void idle() override { @@ -1069,8 +1087,10 @@ public: if (LADSPA_IS_HARD_RT_CAPABLE(fDescriptor->Properties)) pData->hints |= PLUGIN_IS_RTSAFE; +#ifdef HAVE_LIBLO if (fUiFilename != nullptr) pData->hints |= PLUGIN_HAS_CUSTOM_UI; +#endif #ifndef BUILD_BRIDGE if (aOuts > 0 && (aIns == aOuts || aIns == 1)) @@ -1204,7 +1224,7 @@ public: } } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC Names if (pData->engine->isOscControlRegistered()) { @@ -2117,6 +2137,7 @@ public: carla_debug("CarlaPluginDSSI::clearBuffers() - end"); } +#ifdef HAVE_LIBLO // ------------------------------------------------------------------- // OSC stuff @@ -2315,7 +2336,9 @@ public: // tell frontend pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); } +#endif +#ifdef HAVE_LIBLO // ------------------------------------------------------------------- // Post-poned UI Stuff @@ -2377,6 +2400,7 @@ public: osc_send_midi(fOscData, midiData); #endif } +#endif // ------------------------------------------------------------------- @@ -2390,6 +2414,7 @@ public: return fDssiDescriptor; } +#ifdef HAVE_LIBLO uintptr_t getUiBridgeProcessId() const noexcept override { return fThreadUI.getProcessPID(); @@ -2399,6 +2424,7 @@ public: { return fUiFilename; } +#endif // ------------------------------------------------------------------- @@ -2562,6 +2588,7 @@ public: } } +#ifdef HAVE_LIBLO // --------------------------------------------------------------- // gui stuff @@ -2570,6 +2597,7 @@ public: fThreadUI.setData(guiFilename, fDescriptor->Label); fUiFilename = guiFilename; } +#endif // --------------------------------------------------------------- // set default options @@ -2617,7 +2645,9 @@ private: const DSSI_Descriptor* fDssiDescriptor; bool fUsesCustomData; +#ifdef HAVE_LIBLO const char* fUiFilename; +#endif float** fAudioInBuffers; float** fAudioOutBuffers; @@ -2628,8 +2658,10 @@ private: snd_seq_event_t fMidiEvents[kPluginMaxMidiEvents]; +#ifdef HAVE_LIBLO CarlaOscData fOscData; CarlaThreadDSSIUI fThreadUI; +#endif // ------------------------------------------------------------------- diff --git a/source/backend/plugin/CarlaPluginInternal.cpp b/source/backend/plugin/CarlaPluginInternal.cpp index 644f4ab8b..5b56f4311 100644 --- a/source/backend/plugin/CarlaPluginInternal.cpp +++ b/source/backend/plugin/CarlaPluginInternal.cpp @@ -743,7 +743,7 @@ void CarlaPlugin::ProtectedData::updateParameterValues(CarlaPlugin* const plugin if (useDefault) param.ranges[i].def = value; -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) if (sendOsc) { if (useDefault) @@ -760,10 +760,8 @@ void CarlaPlugin::ProtectedData::updateParameterValues(CarlaPlugin* const plugin } } -#ifdef BUILD_BRIDGE - // unused + // may be unused return; (void)sendOsc; -#endif } // ----------------------------------------------------------------------- diff --git a/source/backend/plugin/CarlaPluginInternal.hpp b/source/backend/plugin/CarlaPluginInternal.hpp index 3d75ae70d..0cb50e350 100644 --- a/source/backend/plugin/CarlaPluginInternal.hpp +++ b/source/backend/plugin/CarlaPluginInternal.hpp @@ -21,7 +21,6 @@ #include "CarlaPlugin.hpp" #include "CarlaLibUtils.hpp" -#include "CarlaOscUtils.hpp" #include "CarlaStateUtils.hpp" #include "CarlaMIDI.h" diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index 14bb96d95..6b2c8b4e1 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -2470,7 +2470,7 @@ public: } } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC Names if (pData->engine->isOscControlRegistered()) { diff --git a/source/backend/plugin/CarlaPluginNative.cpp b/source/backend/plugin/CarlaPluginNative.cpp index 93c5cb426..5651ce48f 100644 --- a/source/backend/plugin/CarlaPluginNative.cpp +++ b/source/backend/plugin/CarlaPluginNative.cpp @@ -1197,7 +1197,7 @@ public: } } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC Names if (pData->engine->isOscControlRegistered()) { diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index 11e6f7928..10bcaa95a 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -356,10 +356,10 @@ public: // simulate an updateDisplay callback handleAudioMasterCallback(audioMasterUpdateDisplay, 0, 0, nullptr, 0.0f); -#ifdef BUILD_BRIDGE - const bool sendOsc(false); -#else +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) const bool sendOsc(pData->engine->isOscControlRegistered()); +#else + const bool sendOsc(false); #endif pData->updateParameterValues(this, sendOsc, true, false); } @@ -912,7 +912,7 @@ public: } } -#ifndef BUILD_BRIDGE +#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) // Update OSC Names if (pData->engine->isOscControlRegistered()) { diff --git a/source/native-plugins/distrho-3bandeq.cpp b/source/native-plugins/distrho-3bandeq.cpp index a8f0dd595..8574244f9 100644 --- a/source/native-plugins/distrho-3bandeq.cpp +++ b/source/native-plugins/distrho-3bandeq.cpp @@ -26,12 +26,16 @@ // Plugin Code #include "distrho-3bandeq/DistrhoArtwork3BandEQ.cpp" #include "distrho-3bandeq/DistrhoPlugin3BandEQ.cpp" +#ifdef HAVE_DGL #include "distrho-3bandeq/DistrhoUI3BandEQ.cpp" +#endif // DISTRHO Code #define DISTRHO_PLUGIN_TARGET_CARLA #include "DistrhoPluginMain.cpp" +#ifdef HAVE_DGL #include "DistrhoUIMain.cpp" +#endif START_NAMESPACE_DISTRHO diff --git a/source/native-plugins/distrho-3bandsplitter.cpp b/source/native-plugins/distrho-3bandsplitter.cpp index 8bcb6722c..097afabf9 100644 --- a/source/native-plugins/distrho-3bandsplitter.cpp +++ b/source/native-plugins/distrho-3bandsplitter.cpp @@ -26,12 +26,16 @@ // Plugin Code #include "distrho-3bandsplitter/DistrhoArtwork3BandSplitter.cpp" #include "distrho-3bandsplitter/DistrhoPlugin3BandSplitter.cpp" +#ifdef HAVE_DGL #include "distrho-3bandsplitter/DistrhoUI3BandSplitter.cpp" +#endif // DISTRHO Code #define DISTRHO_PLUGIN_TARGET_CARLA #include "DistrhoPluginMain.cpp" +#ifdef HAVE_DGL #include "DistrhoUIMain.cpp" +#endif START_NAMESPACE_DISTRHO diff --git a/source/native-plugins/distrho-mverb.cpp b/source/native-plugins/distrho-mverb.cpp index 9ac82f670..65e9e6323 100644 --- a/source/native-plugins/distrho-mverb.cpp +++ b/source/native-plugins/distrho-mverb.cpp @@ -26,13 +26,17 @@ // Plugin Code #include "distrho-mverb/DistrhoArtworkMVerb.cpp" #include "distrho-mverb/DistrhoPluginMVerb.cpp" +#ifdef HAVE_DGL #include "distrho-mverb/DistrhoUIMVerb.cpp" #include "distrho-mverb/font/Kh-Kangrey.cpp" +#endif // DISTRHO Code #define DISTRHO_PLUGIN_TARGET_CARLA #include "DistrhoPluginMain.cpp" +#ifdef HAVE_DGL #include "DistrhoUIMain.cpp" +#endif START_NAMESPACE_DISTRHO diff --git a/source/native-plugins/distrho-nekobi.cpp b/source/native-plugins/distrho-nekobi.cpp index 369fc37c0..d8923806a 100644 --- a/source/native-plugins/distrho-nekobi.cpp +++ b/source/native-plugins/distrho-nekobi.cpp @@ -26,12 +26,16 @@ // Plugin Code #include "distrho-nekobi/DistrhoArtworkNekobi.cpp" #include "distrho-nekobi/DistrhoPluginNekobi.cpp" +#ifdef HAVE_DGL #include "distrho-nekobi/DistrhoUINekobi.cpp" +#endif // DISTRHO Code #define DISTRHO_PLUGIN_TARGET_CARLA #include "DistrhoPluginMain.cpp" +#ifdef HAVE_DGL #include "DistrhoUIMain.cpp" +#endif START_NAMESPACE_DISTRHO diff --git a/source/native-plugins/distrho-pingpongpan.cpp b/source/native-plugins/distrho-pingpongpan.cpp index 233929d5b..cb06302f8 100644 --- a/source/native-plugins/distrho-pingpongpan.cpp +++ b/source/native-plugins/distrho-pingpongpan.cpp @@ -26,12 +26,16 @@ // Plugin Code #include "distrho-pingpongpan/DistrhoArtworkPingPongPan.cpp" #include "distrho-pingpongpan/DistrhoPluginPingPongPan.cpp" +#ifdef HAVE_DGL #include "distrho-pingpongpan/DistrhoUIPingPongPan.cpp" +#endif // DISTRHO Code #define DISTRHO_PLUGIN_TARGET_CARLA #include "DistrhoPluginMain.cpp" +#ifdef HAVE_DGL #include "DistrhoUIMain.cpp" +#endif START_NAMESPACE_DISTRHO