diff --git a/Makefile b/Makefile index a5c61bb32..19706e5df 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,10 @@ ifeq ($(HAVE_QT5),true) 3RD_LIBS += $(MODULEDIR)/theme.qt5.a endif +ifeq ($(HAVE_YSFX),true) +3RD_LIBS += $(MODULEDIR)/ysfx.a +endif + ifeq ($(USING_JUCE),true) 3RD_LIBS += $(MODULEDIR)/carla_juce.a 3RD_LIBS += $(MODULEDIR)/juce_audio_basics.a @@ -90,8 +94,6 @@ ifeq ($(USING_RTAUDIO),true) 3RD_LIBS += $(MODULEDIR)/rtmidi.a endif -3RD_LIBS += $(MODULEDIR)/ysfx.a - ALL_LIBS += $(3RD_LIBS) 3rd: $(3RD_LIBS) diff --git a/source/Makefile.deps.mk b/source/Makefile.deps.mk index 5f273607c..0c6d3f76c 100644 --- a/source/Makefile.deps.mk +++ b/source/Makefile.deps.mk @@ -192,6 +192,9 @@ ifeq ($(WASM),true) HAVE_DGL = false endif +# NOTE opt-out rather than opt-in +HAVE_YSFX = true + # NOTE not yet implemented, disabled for now HAVE_YSFXGUI = false @@ -636,7 +639,7 @@ WATER_LIBS = -ldl -pthread -lrt else ifeq ($(MACOS),true) HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1 -HYLIA_LIBS = +HYLIA_LIBS = JACKBRIDGE_LIBS = -ldl -pthread LILV_LIBS = -ldl -lm RTMEMPOOL_LIBS = -pthread diff --git a/source/Makefile.mk b/source/Makefile.mk index 3f45dd365..417e8fcfd 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -233,6 +233,10 @@ ifeq ($(HAVE_X11),true) BASE_FLAGS += -DHAVE_X11 endif +ifeq ($(HAVE_YSFX),true) +BASE_FLAGS += -DHAVE_YSFX +endif + ifeq ($(USING_JUCE),true) BASE_FLAGS += -DUSING_JUCE BASE_FLAGS += -DJUCE_APP_CONFIG_HEADER='"AppConfig.h"' diff --git a/source/backend/Makefile b/source/backend/Makefile index 8c14c7910..03c89570f 100644 --- a/source/backend/Makefile +++ b/source/backend/Makefile @@ -50,6 +50,10 @@ ifeq ($(HAVE_HYLIA),true) STANDALONE_LIBS += $(MODULEDIR)/hylia.a endif +ifeq ($(HAVE_YSFX),true) +STANDALONE_LIBS += $(MODULEDIR)/ysfx.a +endif + ifeq ($(USING_JUCE),true) STANDALONE_LIBS += $(MODULEDIR)/carla_juce.a STANDALONE_LIBS += $(MODULEDIR)/juce_audio_basics.a @@ -70,8 +74,6 @@ STANDALONE_LIBS += $(MODULEDIR)/rtaudio.a STANDALONE_LIBS += $(MODULEDIR)/rtmidi.a endif -STANDALONE_LIBS += $(MODULEDIR)/ysfx.a - # --------------------------------------------------------------------------------------------------------------------- STANDALONE_LINK_FLAGS = $(HYLIA_LIBS) @@ -87,6 +89,10 @@ STANDALONE_LINK_FLAGS += $(FLUIDSYNTH_LIBS) STANDALONE_LINK_FLAGS += $(SDL_LIBS) STANDALONE_LINK_FLAGS += $(X11_LIBS) +ifeq ($(HAVE_YSFX),true) +STANDALONE_LINK_FLAGS += $(YSFX_GRAPHICS_LIBS) +endif + ifeq ($(USING_JUCE),true) STANDALONE_LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) ifeq ($(USING_JUCE_AUDIO_DEVICES),true) @@ -106,8 +112,6 @@ STANDALONE_LINK_FLAGS += $(RTAUDIO_LIBS) STANDALONE_LINK_FLAGS += $(RTMIDI_LIBS) endif -STANDALONE_LINK_FLAGS += $(YSFX_GRAPHICS_LIBS) - ifeq ($(JACKBRIDGE_DIRECT),true) STANDALONE_LINK_FLAGS += $(JACK_LIBS) endif diff --git a/source/backend/plugin/CarlaPluginJSFX.cpp b/source/backend/plugin/CarlaPluginJSFX.cpp index b4f991801..3db5a1638 100644 --- a/source/backend/plugin/CarlaPluginJSFX.cpp +++ b/source/backend/plugin/CarlaPluginJSFX.cpp @@ -1,6 +1,6 @@ /* * Carla JSFX Plugin - * Copyright (C) 2021 Filipe Coelho + * Copyright (C) 2021-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -19,6 +19,9 @@ #include "CarlaPluginInternal.hpp" #include "CarlaEngine.hpp" + +#ifdef HAVE_YSFX + #include "CarlaJsfxUtils.hpp" #include "CarlaBackendUtils.hpp" #include "CarlaUtils.hpp" @@ -1067,6 +1070,12 @@ private: CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginJSFX) }; +CARLA_BACKEND_END_NAMESPACE + +#endif // HAVE_YSFX + +CARLA_BACKEND_START_NAMESPACE + // ------------------------------------------------------------------------------------------------------------------- CarlaPluginPtr CarlaPlugin::newJSFX(const Initializer& init) @@ -1074,12 +1083,17 @@ CarlaPluginPtr CarlaPlugin::newJSFX(const Initializer& init) carla_debug("CarlaPlugin::newJSFX({%p, \"%s\", \"%s\", \"%s\", " P_INT64 "})", init.engine, init.filename, init.name, init.label, init.uniqueId); +#ifdef HAVE_YSFX std::shared_ptr plugin(new CarlaPluginJSFX(init.engine, init.id)); if (! plugin->initJSFX(plugin, init.filename, init.name, init.label, init.options)) return nullptr; return plugin; +#else + init.engine->setLastError("JSFX support not available"); + return nullptr; +#endif } // ------------------------------------------------------------------------------------------------------------------- diff --git a/source/backend/utils/CachedPlugins.cpp b/source/backend/utils/CachedPlugins.cpp index 266e56c6f..41a08ad14 100644 --- a/source/backend/utils/CachedPlugins.cpp +++ b/source/backend/utils/CachedPlugins.cpp @@ -99,6 +99,7 @@ static void findSFZs(const char* const sfzPaths) } // ------------------------------------------------------------------------------------------------------------------- +#ifdef HAVE_YSFX static std::vector gJSFXs; static void findJSFXs(const char* const jsfxPaths) @@ -131,6 +132,7 @@ static void findJSFXs(const char* const jsfxPaths) } } } +#endif // ------------------------------------------------------------------------------------------------------------------- @@ -665,6 +667,7 @@ static const CarlaCachedPluginInfo* get_cached_plugin_sfz(const water::File& fil // ------------------------------------------------------------------------------------------------------------------- +#ifdef HAVE_YSFX static const CarlaCachedPluginInfo* get_cached_plugin_jsfx(const CB::CarlaJsfxUnit& unit) { static CarlaCachedPluginInfo info; @@ -737,6 +740,7 @@ static const CarlaCachedPluginInfo* get_cached_plugin_jsfx(const CB::CarlaJsfxUn return &info; } +#endif // ------------------------------------------------------------------------------------------------------------------- @@ -771,10 +775,12 @@ uint carla_get_cached_plugin_count(CB::PluginType ptype, const char* pluginPath) return static_cast(gSFZs.size()); } +#ifdef HAVE_YSFX case CB::PLUGIN_JSFX: { findJSFXs(pluginPath); return static_cast(gJSFXs.size()); } +#endif default: return 0; @@ -821,10 +827,12 @@ const CarlaCachedPluginInfo* carla_get_cached_plugin_info(CB::PluginType ptype, return get_cached_plugin_sfz(gSFZs[index]); } +#ifdef HAVE_YSFX case CB::PLUGIN_JSFX: { CARLA_SAFE_ASSERT_BREAK(index < static_cast(gJSFXs.size())); return get_cached_plugin_jsfx(gJSFXs[index]); } +#endif default: break; diff --git a/source/backend/utils/Information.cpp b/source/backend/utils/Information.cpp index 908932d8b..bbcfac5f4 100644 --- a/source/backend/utils/Information.cpp +++ b/source/backend/utils/Information.cpp @@ -1,6 +1,6 @@ /* * Carla Plugin Host - * Copyright (C) 2011-2022 Filipe Coelho + * Copyright (C) 2011-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -77,8 +77,9 @@ const char* carla_get_complete_license_text() #if defined(USING_JUCE) && JUCE_PLUGINHOST_AU "
  • AU plugin support (using JUCE)
  • " #endif - +#ifdef HAVE_YSFX "
  • JSFX plugin support (using ysfx)
  • " +#endif // Sample kit libraries #if defined(HAVE_FLUIDSYNTH) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) @@ -190,8 +191,10 @@ const char* const* carla_get_supported_file_extensions() // SFZ "sfz", +#ifdef HAVE_YSFX // JSFX "jsfx", +#endif // terminator nullptr @@ -223,6 +226,9 @@ const char* const* carla_get_supported_features() #ifdef HAVE_PYQT "gui", #endif +#ifdef HAVE_YSFX + "jsfx", +#endif #ifdef USING_JUCE "juce", # if defined(CARLA_OS_MAC) diff --git a/source/backend/utils/Makefile b/source/backend/utils/Makefile index 238274bf0..5cb2fc26b 100644 --- a/source/backend/utils/Makefile +++ b/source/backend/utils/Makefile @@ -28,7 +28,10 @@ TARGETS = $(BINDIR)/libcarla_utils$(LIB_EXT) LIBS = $(MODULEDIR)/lilv.a LIBS += $(MODULEDIR)/water.files.a + +ifeq ($(HAVE_YSFX),true) LIBS += $(MODULEDIR)/ysfx.a +endif ifeq ($(USING_JUCE),true) LIBS += $(MODULEDIR)/carla_juce.a @@ -44,12 +47,15 @@ endif LINK_FLAGS += $(LILV_LIBS) LINK_FLAGS += $(WATER_LIBS) -LINK_FLAGS += $(YSFX_GRAPHICS_LIBS) ifeq ($(HAVE_X11),true) LINK_FLAGS += $(X11_LIBS) endif +ifeq ($(HAVE_YSFX),true) +LINK_FLAGS += $(YSFX_GRAPHICS_LIBS) +endif + ifneq ($(HAIKU),true) ifneq ($(WASM),true) LINK_FLAGS += -pthread diff --git a/source/bridges-plugin/Makefile b/source/bridges-plugin/Makefile index 034015520..74dff77d6 100644 --- a/source/bridges-plugin/Makefile +++ b/source/bridges-plugin/Makefile @@ -93,6 +93,11 @@ LIBS_win32 += $(MODULEDIR)/water.win32.a LIBS_win64 += $(MODULEDIR)/water.win64.a LINK_FLAGS += $(WATER_LIBS) +ifeq ($(HAVE_YSFX),true) +LIBS_native += $(MODULEDIR)/ysfx.a +LINK_FLAGS += $(YSFX_GRAPHICS_LIBS) +endif + ifeq ($(USING_JUCE),true) LIBS_native += $(MODULEDIR)/carla_juce.a LIBS_posix32 += $(MODULEDIR)/carla_juce.posix32.a @@ -157,9 +162,6 @@ LIBS_win64 += $(MODULEDIR)/juce_gui_extra.win64.a LINK_FLAGS += $(JUCE_GUI_EXTRA_LIBS) endif -LIBS_native += $(MODULEDIR)/ysfx.a -LINK_FLAGS += $(YSFX_GRAPHICS_LIBS) - ifeq ($(JACKBRIDGE_DIRECT),true) LINK_FLAGS += $(JACK_LIBS) endif diff --git a/source/discovery/Makefile b/source/discovery/Makefile index 5590d2152..9902b1711 100644 --- a/source/discovery/Makefile +++ b/source/discovery/Makefile @@ -63,7 +63,9 @@ NATIVE_BUILD_FLAGS += $(FLUIDSYNTH_FLAGS) NATIVE_LINK_FLAGS += $(FLUIDSYNTH_LIBS) endif +ifeq ($(HAVE_YSFX),true) NATIVE_BUILD_FLAGS += $(YSFX_FLAGS) +endif # --------------------------------------------------------------------------------------------------------------------- @@ -84,6 +86,11 @@ LIBS_win64 = $(MODULEDIR)/water.win64.a LINK_FLAGS += $(WATER_LIBS) LINK_FLAGS += $(LIBDL_LIBS) +ifeq ($(HAVE_YSFX),true) +LIBS_native += $(MODULEDIR)/ysfx.a +LINK_FLAGS += $(YSFX_GRAPHICS_LIBS) +endif + ifeq ($(USING_JUCE),true) LIBS_native += $(MODULEDIR)/carla_juce.a LIBS_posix32 += $(MODULEDIR)/carla_juce.posix32.a @@ -148,9 +155,6 @@ LIBS_win64 += $(MODULEDIR)/juce_gui_extra.win64.a LINK_FLAGS += $(JUCE_GUI_EXTRA_LIBS) endif # USING_JUCE -LIBS_native += $(MODULEDIR)/ysfx.a -LINK_FLAGS += $(YSFX_GRAPHICS_LIBS) - # --------------------------------------------------------------------------------------------------------------------- OBJS_native = $(OBJDIR)/$(MODULENAME).cpp.o diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index e730a5b41..569d6805f 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -1,6 +1,6 @@ /* * Carla Plugin discovery - * Copyright (C) 2011-2022 Filipe Coelho + * Copyright (C) 2011-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -44,6 +44,7 @@ #ifdef BUILD_BRIDGE # undef HAVE_FLUIDSYNTH +# undef HAVE_YSFX #endif #ifdef HAVE_FLUIDSYNTH @@ -2373,9 +2374,9 @@ static void do_fluidsynth_check(const char* const filename, const PluginType typ // ------------------------------------------------------------------------------------------------------------------- -#ifndef BUILD_BRIDGE static void do_jsfx_check(const char* const filename, bool doInit) { +#ifdef HAVE_YSFX const water::File file(filename); ysfx_config_u config(ysfx_config_new()); @@ -2429,8 +2430,15 @@ static void do_jsfx_check(const char* const filename, bool doInit) DISCOVERY_OUT("midi.outs", midiOuts); DISCOVERY_OUT("parameters.ins", parameters); DISCOVERY_OUT("end", "------------"); -} +#else // HAVE_YSFX + DISCOVERY_OUT("error", "JSFX support not available"); + return; + + // unused + (void)filename; + (void)doInit; #endif +} // ------------------------------ main entry point ------------------------------ diff --git a/source/plugin/Makefile b/source/plugin/Makefile index 977a6aba5..8aba8258e 100644 --- a/source/plugin/Makefile +++ b/source/plugin/Makefile @@ -50,12 +50,14 @@ ifeq ($(HAVE_FLUIDSYNTH),true) BUILD_CXX_FLAGS += $(FLUIDSYNTH_FLAGS) endif -BUILD_CXX_FLAGS += $(YSFX_FLAGS) - ifeq ($(HAVE_X11),true) BUILD_CXX_FLAGS += $(X11_FLAGS) endif +ifeq ($(HAVE_YSFX),true) +BUILD_CXX_FLAGS += $(YSFX_FLAGS) +endif + # --------------------------------------------------------------------------------------------------------------------- # Libs @@ -88,6 +90,10 @@ ifeq ($(HAVE_HYLIA),true) LIBS += $(MODULEDIR)/hylia.a endif +ifeq ($(HAVE_YSFX),true) +LIBS += $(MODULEDIR)/ysfx.a +endif + ifeq ($(USING_JUCE),true) LIBS_juce = $(MODULEDIR)/carla_juce.a LIBS_juce += $(MODULEDIR)/juce_audio_basics.a @@ -100,8 +106,6 @@ LIBS_juce += $(MODULEDIR)/juce_gui_basics.a LIBS_juce += $(MODULEDIR)/juce_gui_extra.a endif -LIBS += $(MODULEDIR)/ysfx.a - # --------------------------------------------------------------------------------------------------------------------- # Link flags