diff --git a/carla b/carla index 54effcd..0972c33 160000 --- a/carla +++ b/carla @@ -1 +1 @@ -Subproject commit 54effcd901f4540aff9ff933880941d9153bd50a +Subproject commit 0972c333b4de0a53a5bfb9731d558965e0010f7d diff --git a/plugins/Cardinal/src/Ildaeil.cpp b/plugins/Cardinal/src/Ildaeil.cpp index 60d86a6..6574f42 100644 --- a/plugins/Cardinal/src/Ildaeil.cpp +++ b/plugins/Cardinal/src/Ildaeil.cpp @@ -52,6 +52,19 @@ json_t *jsonp_stringn_nocheck_own(const char* value, size_t len); } #endif +// defined elsewhere +namespace rack { +#ifdef ARCH_WIN +enum SpecialPath { + kSpecialPathUserProfile, + kSpecialPathCommonProgramFiles, + kSpecialPathAppData, +}; +std::string getSpecialPath(const SpecialPath type) +#endif +std::string homeDir(); +} + #define BUFFER_SIZE 128 // generates a warning if this is defined as anything else @@ -97,6 +110,28 @@ static void projectLoadedFromDSP(void* ui); static Mutex sPluginInfoLoadMutex; +static const char* getPathForJSFX() +{ + static std::string path; + + if (path.empty()) + { + #if defined(CARLA_OS_MAC) + path = homeDir() + "/Library/Application Support/REAPER/Effects"; + #elif defined(CARLA_OS_WIN) + path = getSpecialPath() + "\\REAPER\\Effects" + #else + if (const char* const configHome = std::getenv("XDG_CONFIG_HOME")) + path = configHome; + else + path = homeDir() + "/.config"; + path += "/REAPER/Effects"; + #endif + } + + return path.c_str(); +} + /* #ifndef HEADLESS struct JuceInitializer { @@ -249,6 +284,8 @@ struct IldaeilModule : Module { if (const char* const path = std::getenv("LV2_PATH")) carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, path); + carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PLUGIN_PATH, PLUGIN_JSFX, getPathForJSFX()); + #ifdef CARLA_OS_MAC carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PREFER_UI_BRIDGES, 0, nullptr); #endif @@ -1068,7 +1105,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { { case PLUGIN_INTERNAL: case PLUGIN_AU: - // case PLUGIN_JSFX: + case PLUGIN_JSFX: case PLUGIN_SFZ: label = info.label; break; @@ -1096,6 +1133,9 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { case PLUGIN_LV2: path = std::getenv("LV2_PATH"); break; + case PLUGIN_JSFX: + path = getPathForJSFX(); + break; default: path = nullptr; break; @@ -1386,6 +1426,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { static const char* pluginTypes[] = { getPluginTypeAsString(PLUGIN_INTERNAL), getPluginTypeAsString(PLUGIN_LV2), + getPluginTypeAsString(PLUGIN_JSFX), }; setupMainWindowPos(); @@ -1431,6 +1472,9 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { int current; switch (fPluginType) { + case PLUGIN_JSFX: + current = 2; + break; case PLUGIN_LV2: current = 1; break; @@ -1450,6 +1494,9 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { case 1: fNextPluginType = PLUGIN_LV2; break; + case 2: + fNextPluginType = PLUGIN_JSFX; + break; } } @@ -1485,7 +1532,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { case PLUGIN_INTERNAL: case PLUGIN_AU: case PLUGIN_SFZ: - // case PLUGIN_JSFX: + case PLUGIN_JSFX: ImGui::TableSetupColumn("Name"); ImGui::TableSetupColumn("Label"); ImGui::TableHeadersRow(); @@ -1512,7 +1559,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { { case PLUGIN_INTERNAL: case PLUGIN_AU: - // case PLUGIN_JSFX: + case PLUGIN_JSFX: case PLUGIN_SFZ: ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); diff --git a/src/CardinalCommon.cpp b/src/CardinalCommon.cpp index 185174f..4ce501f 100644 --- a/src/CardinalCommon.cpp +++ b/src/CardinalCommon.cpp @@ -55,6 +55,7 @@ const std::string CARDINAL_VERSION = "22.05"; namespace rack { + namespace settings { int rateLimit = 0; } @@ -76,6 +77,9 @@ std::string getSpecialPath(const SpecialPath type) case kSpecialPathCommonProgramFiles: csidl = CSIDL_PROGRAM_FILES_COMMON; break; + case kSpecialPathAppData: + csidl = CSIDL_COMMON_APPDATA; + break; default: return {}; } @@ -88,8 +92,22 @@ std::string getSpecialPath(const SpecialPath type) return {}; } #endif + +std::string homeDir() +{ +# ifdef ARCH_WIN + return getSpecialPath(kSpecialPathUserProfile); +# else + if (const char* const home = getenv("HOME")) + return home; + if (struct passwd* const pwd = getpwuid(getuid())) + return pwd->pw_dir; +# endif + return {}; } +} // namespace rack + namespace patchUtils { @@ -103,19 +121,6 @@ static void promptClear(const char* const message, const std::function a asyncDialog::create(message, action); } - -static std::string homeDir() -{ -# ifdef ARCH_WIN - return getSpecialPath(kSpecialPathUserProfile); -# else - if (const char* const home = getenv("HOME")) - return home; - if (struct passwd* const pwd = getpwuid(getuid())) - return pwd->pw_dir; -# endif - return {}; -} #endif void loadDialog() diff --git a/src/CardinalCommon.hpp b/src/CardinalCommon.hpp index e7584c8..132155b 100644 --- a/src/CardinalCommon.hpp +++ b/src/CardinalCommon.hpp @@ -47,6 +47,7 @@ bool isStandalone(); enum SpecialPath { kSpecialPathUserProfile, kSpecialPathCommonProgramFiles, + kSpecialPathAppData, }; std::string getSpecialPath(SpecialPath type); #endif diff --git a/src/Makefile.cardinal.mk b/src/Makefile.cardinal.mk index f83d3c0..a647e19 100644 --- a/src/Makefile.cardinal.mk +++ b/src/Makefile.cardinal.mk @@ -43,6 +43,7 @@ CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/lilv.a CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/rtmempool.a CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/sfzero.a CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/water.a +CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/ysfx.a CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/zita-resampler.a endif # STATIC_BUILD