From 9de72258bd8375de1c3b22fc2a250156be1aa1ef Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 16 Jan 2019 17:18:34 +0100 Subject: [PATCH] More fixes Signed-off-by: falkTX --- Makefile | 6 +++--- source/backend/Makefile | 2 -- source/backend/plugin/CarlaPluginJuce.cpp | 7 +++++++ source/backend/plugin/CarlaPluginVST2.cpp | 10 +++++++--- source/modules/AppConfig.h | 1 + .../juce_audio_devices/native/juce_linux_Midi.cpp | 14 +++++++++----- .../juce_audio_processors.cpp | 15 +++++++++++---- .../scanning/juce_KnownPluginList.cpp | 4 ++++ .../scanning/juce_KnownPluginList.h | 2 ++ 9 files changed, 44 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index ad223f340..8d86aec1d 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,6 @@ ifeq ($(HAVE_HYLIA),true) ALL_LIBS += $(MODULEDIR)/hylia.a endif -ALL_LIBS += $(MODULEDIR)/rtaudio.a -ALL_LIBS += $(MODULEDIR)/rtmidi.a - ifeq ($(HAVE_QT4),true) ALL_LIBS += $(MODULEDIR)/theme.qt4.a endif @@ -70,6 +67,9 @@ ifeq ($(MACOS_OR_WIN32),true) ALL_LIBS += $(MODULEDIR)/juce_graphics.a ALL_LIBS += $(MODULEDIR)/juce_gui_basics.a endif +else +ALL_LIBS += $(MODULEDIR)/rtaudio.a +ALL_LIBS += $(MODULEDIR)/rtmidi.a endif libs: $(ALL_LIBS) diff --git a/source/backend/Makefile b/source/backend/Makefile index 9330c09eb..6a7b82eed 100644 --- a/source/backend/Makefile +++ b/source/backend/Makefile @@ -47,8 +47,6 @@ STANDALONE_LIBS += $(MODULEDIR)/juce_events.a ifeq ($(MACOS_OR_WIN32),true) STANDALONE_LIBS += $(MODULEDIR)/juce_graphics.a STANDALONE_LIBS += $(MODULEDIR)/juce_gui_basics.a -# ifeq ($(MACOS),true) -# STANDALONE_LIBS += $(MODULEDIR)/juce_gui_extra.a endif else STANDALONE_LIBS += $(MODULEDIR)/rtaudio.a diff --git a/source/backend/plugin/CarlaPluginJuce.cpp b/source/backend/plugin/CarlaPluginJuce.cpp index 3d3a88285..7cbac2a25 100644 --- a/source/backend/plugin/CarlaPluginJuce.cpp +++ b/source/backend/plugin/CarlaPluginJuce.cpp @@ -1190,6 +1190,13 @@ public: juce::KnownPluginList plist; for (int i = 0; i < fFormatManager.getNumFormats(); ++i) plist.scanAndAddFile(fileOrIdentifier, true, pluginDescriptions, *fFormatManager.getFormat(i)); + + if (pluginDescriptions.size() == 0) + { + pData->engine->setLastError("Failed to get plugin description"); + return false; + } + fDesc = *pluginDescriptions[0]; } diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index 3979aeb52..21051cb4e 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -18,7 +18,11 @@ #include "CarlaPluginInternal.hpp" #include "CarlaEngine.hpp" -#ifndef USING_JUCE +#if defined(USING_JUCE) && (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)) +# define USE_JUCE_FOR_VST2 +#endif + +#ifndef USE_JUCE_FOR_VST2 #include "CarlaVstUtils.hpp" @@ -2621,7 +2625,7 @@ CarlaPluginVST2* CarlaPluginVST2::sLastCarlaPluginVST2 = nullptr; CARLA_BACKEND_END_NAMESPACE -#endif // USING_JUCE +#endif // USE_JUCE_FOR_VST2 // ------------------------------------------------------------------------------------------------------------------- @@ -2631,7 +2635,7 @@ CarlaPlugin* CarlaPlugin::newVST2(const Initializer& init) { carla_debug("CarlaPlugin::newVST2({%p, \"%s\", \"%s\", " P_INT64 "})", init.engine, init.filename, init.name, init.uniqueId); -#ifdef USING_JUCE +#ifdef USE_JUCE_FOR_VST2 return newJuce(init, "VST2"); #else CarlaPluginVST2* const plugin(new CarlaPluginVST2(init.engine, init.id)); diff --git a/source/modules/AppConfig.h b/source/modules/AppConfig.h index b163db525..0eb19de91 100644 --- a/source/modules/AppConfig.h +++ b/source/modules/AppConfig.h @@ -113,6 +113,7 @@ */ #ifdef APPCONFIG_OS_LINUX #define JUCE_ALSA 1 + #define JUCE_ALSA_MIDI_NAME "Carla" #define JUCE_ALSA_MIDI_INPUT_NAME "Carla" #define JUCE_ALSA_MIDI_OUTPUT_NAME "Carla" #define JUCE_ALSA_MIDI_INPUT_PORT_NAME "Midi In" diff --git a/source/modules/juce_audio_devices/native/juce_linux_Midi.cpp b/source/modules/juce_audio_devices/native/juce_linux_Midi.cpp index ef4dfade8..df3737ada 100644 --- a/source/modules/juce_audio_devices/native/juce_linux_Midi.cpp +++ b/source/modules/juce_audio_devices/native/juce_linux_Midi.cpp @@ -275,12 +275,16 @@ private: jassert (instance == nullptr); snd_seq_open (&handle, "default", SND_SEQ_OPEN_DUPLEX, 0); - snd_seq_nonblock (handle, SND_SEQ_NONBLOCK); - snd_seq_set_client_name (handle, JUCE_ALSA_MIDI_NAME); - clientId = snd_seq_client_id(handle); - // It's good idea to pre-allocate a good number of elements - ports.ensureStorageAllocated (32); + if (handle != nullptr) + { + snd_seq_nonblock (handle, SND_SEQ_NONBLOCK); + snd_seq_set_client_name (handle, JUCE_ALSA_MIDI_NAME); + clientId = snd_seq_client_id(handle); + + // It's good idea to pre-allocate a good number of elements + ports.ensureStorageAllocated (32); + } } ~AlsaClient() diff --git a/source/modules/juce_audio_processors/juce_audio_processors.cpp b/source/modules/juce_audio_processors/juce_audio_processors.cpp index 675784f1c..eef6d1c79 100644 --- a/source/modules/juce_audio_processors/juce_audio_processors.cpp +++ b/source/modules/juce_audio_processors/juce_audio_processors.cpp @@ -37,7 +37,10 @@ #define JUCE_CORE_INCLUDE_OBJC_HELPERS 1 #include "juce_audio_processors.h" -#include + +#if JUCE_MODULE_AVAILABLE_juce_gui_extra + #include +#endif //============================================================================== #if JUCE_MAC @@ -180,6 +183,10 @@ void AutoResizingNSViewComponentWithParent::timerCallback() override #include "format_types/juce_AudioUnitPluginFormat.mm" #include "scanning/juce_KnownPluginList.cpp" #include "scanning/juce_PluginDirectoryScanner.cpp" -#include "scanning/juce_PluginListComponent.cpp" -#include "utilities/juce_AudioProcessorParameters.cpp" -#include "utilities/juce_AudioProcessorValueTreeState.cpp" +#if ! JUCE_AUDIOPROCESSOR_NO_GUI + #include "scanning/juce_PluginListComponent.cpp" +#endif + #include "utilities/juce_AudioProcessorParameters.cpp" +#if ! JUCE_AUDIOPROCESSOR_NO_GUI + #include "utilities/juce_AudioProcessorValueTreeState.cpp" +#endif diff --git a/source/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp b/source/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp index f7c0bf71e..90e5f4d6a 100644 --- a/source/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp +++ b/source/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp @@ -493,6 +493,7 @@ struct PluginTreeUtils return false; } +#if ! JUCE_AUDIOPROCESSOR_NO_GUI static bool addToMenu (const KnownPluginList::PluginTree& tree, PopupMenu& m, const OwnedArray& allPlugins, const String& currentlyTickedPluginID) @@ -523,6 +524,7 @@ struct PluginTreeUtils return isTicked; } +#endif }; KnownPluginList::PluginTree* KnownPluginList::createTree (const SortMethod sortMethod) const @@ -557,12 +559,14 @@ KnownPluginList::PluginTree* KnownPluginList::createTree (const SortMethod sortM } //============================================================================== +#if ! JUCE_AUDIOPROCESSOR_NO_GUI void KnownPluginList::addToMenu (PopupMenu& menu, const SortMethod sortMethod, const String& currentlyTickedPluginID) const { ScopedPointer tree (createTree (sortMethod)); PluginTreeUtils::addToMenu (*tree, menu, types, currentlyTickedPluginID); } +#endif int KnownPluginList::getIndexChosenByMenu (const int menuResultCode) const { diff --git a/source/modules/juce_audio_processors/scanning/juce_KnownPluginList.h b/source/modules/juce_audio_processors/scanning/juce_KnownPluginList.h index 17ce28fb3..da5744035 100644 --- a/source/modules/juce_audio_processors/scanning/juce_KnownPluginList.h +++ b/source/modules/juce_audio_processors/scanning/juce_KnownPluginList.h @@ -142,6 +142,7 @@ public: }; //============================================================================== +#if ! JUCE_AUDIOPROCESSOR_NO_GUI /** Adds all the plugin types to a popup menu so that the user can select one. Depending on the sort method, it may add sub-menus for categories, @@ -151,6 +152,7 @@ public: */ void addToMenu (PopupMenu& menu, SortMethod sortMethod, const String& currentlyTickedPluginID = String()) const; +#endif /** Converts a menu item index that has been chosen into its index in this list. Returns -1 if it's not an ID that was used.