diff --git a/Makefile b/Makefile index d2370ce..014f303 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ include dpf/Makefile.base.mk # also set in: # plugins/Common/IldaeilPlugin.cpp `getVersion` +# plugins/Standalone/macOS/Info.plist VERSION = 1.3 # --------------------------------------------------------------------------------------------------------------------- diff --git a/carla b/carla index be784fc..9317df5 160000 --- a/carla +++ b/carla @@ -1 +1 @@ -Subproject commit be784fcbe29f9f7eb52298023dcbdb11c0b8604a +Subproject commit 9317df59709ae646f6e08a1e2c9834b4a0325101 diff --git a/dpf b/dpf index cb630fa..018e45d 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit cb630fabcb059f35646ac4cacf011a25ffc3ff93 +Subproject commit 018e45db4a40d57761f12e797093e3699b1ca5e3 diff --git a/plugins/Common/IldaeilBasePlugin.hpp b/plugins/Common/IldaeilBasePlugin.hpp index dda7d47..af401b3 100644 --- a/plugins/Common/IldaeilBasePlugin.hpp +++ b/plugins/Common/IldaeilBasePlugin.hpp @@ -41,7 +41,7 @@ public: NativeHostDescriptor fCarlaHostDescriptor; CarlaHostHandle fCarlaHostHandle; - String fDiscoveryTool; + String fBinaryPath; void* fUI; diff --git a/plugins/Common/IldaeilPlugin.cpp b/plugins/Common/IldaeilPlugin.cpp index 50d7927..1088840 100644 --- a/plugins/Common/IldaeilPlugin.cpp +++ b/plugins/Common/IldaeilPlugin.cpp @@ -141,6 +141,25 @@ static const char* getPathForVST2() path += water::File::getSpecialLocation(water::File::winCommonProgramFiles).getFullPathName() + "\\VST2"; #else path = getHomePath() + "/.vst:/usr/lib/vst:/usr/local/lib/vst"; + + water::String winePrefix; + if (const char* const envWINEPREFIX = std::getenv("WINEPREFIX")) + winePrefix = envWINEPREFIX; + + if (winePrefix.isEmpty()) + winePrefix = getHomePath() + "/.wine"; + + if (water::File(winePrefix).exists()) + { + path += ":" + winePrefix + "/drive_c/Program Files/Common Files/VST2"; + path += ":" + winePrefix + "/drive_c/Program Files/VstPlugins"; + path += ":" + winePrefix + "/drive_c/Program Files/Steinberg/VstPlugins"; + #ifdef CARLA_OS_64BIT + path += ":" + winePrefix + "/drive_c/Program Files (x86)/Common Files/VST2"; + path += ":" + winePrefix + "/drive_c/Program Files (x86)/VstPlugins"; + path += ":" + winePrefix + "/drive_c/Program Files (x86)/Steinberg/VstPlugins"; + #endif + } #endif } @@ -164,6 +183,21 @@ static const char* getPathForVST3() path += water::File::getSpecialLocation(water::File::winCommonProgramFiles).getFullPathName() + "\\VST3"; #else path = getHomePath() + "/.vst3:/usr/lib/vst3:/usr/local/lib/vst3"; + + water::String winePrefix; + if (const char* const envWINEPREFIX = std::getenv("WINEPREFIX")) + winePrefix = envWINEPREFIX; + + if (winePrefix.isEmpty()) + winePrefix = getHomePath() + "/.wine"; + + if (water::File(winePrefix).exists()) + { + path += ":" + winePrefix + "/drive_c/Program Files/Common Files/VST3"; + #ifdef CARLA_OS_64BIT + path += ":" + winePrefix + "/drive_c/Program Files (x86)/Common Files/VST3"; + #endif + } #endif } @@ -187,6 +221,21 @@ static const char* getPathForCLAP() path += water::File::getSpecialLocation(water::File::winCommonProgramFiles).getFullPathName() + "\\CLAP"; #else path = getHomePath() + "/.clap:/usr/lib/clap:/usr/local/lib/clap"; + + water::String winePrefix; + if (const char* const envWINEPREFIX = std::getenv("WINEPREFIX")) + winePrefix = envWINEPREFIX; + + if (winePrefix.isEmpty()) + winePrefix = getHomePath() + "/.wine"; + + if (water::File(winePrefix).exists()) + { + path += ":" + winePrefix + "/drive_c/Program Files/Common Files/CLAP"; + #ifdef CARLA_OS_64BIT + path += ":" + winePrefix + "/drive_c/Program Files (x86)/Common Files/CLAP"; + #endif + } #endif } @@ -352,7 +401,7 @@ public: if (bundlePath != nullptr && water::File(bundlePath + water::String(DISTRHO_OS_SEP_STR "carla-bridge-native" EXT)).existsAsFile()) { - fDiscoveryTool = bundlePath; + fBinaryPath = bundlePath; carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_BINARIES, 0, bundlePath); carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_RESOURCES, 0, getResourcePath(bundlePath)); } @@ -360,27 +409,27 @@ public: else if (bundlePath != nullptr && water::File(bundlePath + water::String("/Contents/MacOS/carla-bridge-native" EXT)).existsAsFile()) { - fDiscoveryTool = bundlePath; - fDiscoveryTool += "/Contents/MacOS"; - carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_BINARIES, 0, fDiscoveryTool); + fBinaryPath = bundlePath; + fBinaryPath += "/Contents/MacOS"; + carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_BINARIES, 0, fBinaryPath); carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_RESOURCES, 0, getResourcePath(bundlePath)); } #endif else { #ifdef CARLA_OS_MAC - fDiscoveryTool = "/Applications/Carla.app/Contents/MacOS"; + fBinaryPath = "/Applications/Carla.app/Contents/MacOS"; carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_BINARIES, 0, "/Applications/Carla.app/Contents/MacOS"); carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_RESOURCES, 0, "/Applications/Carla.app/Contents/MacOS/resources"); #else - fDiscoveryTool = "/usr/lib/carla"; + fBinaryPath = "/usr/lib/carla"; carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_BINARIES, 0, "/usr/lib/carla"); carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PATH_RESOURCES, 0, "/usr/share/carla/resources"); #endif } - carla_stdout("Using binary path: %s", fDiscoveryTool.buffer()); - fDiscoveryTool += DISTRHO_OS_SEP_STR "carla-discovery-native" EXT; + if (fBinaryPath.isNotEmpty()) + carla_stdout("Using binary path for discovery tools: %s", fBinaryPath.buffer()); #undef EXT diff --git a/plugins/Common/IldaeilUI.cpp b/plugins/Common/IldaeilUI.cpp index ea2395e..be7f871 100644 --- a/plugins/Common/IldaeilUI.cpp +++ b/plugins/Common/IldaeilUI.cpp @@ -166,6 +166,7 @@ class IldaeilUI : public UI, IldaeilBasePlugin* const fPlugin; PluginHostWindow fPluginHostWindow; + BinaryType fBinaryType; PluginType fPluginType; PluginType fNextPluginType; uint fPluginId; @@ -174,6 +175,7 @@ class IldaeilUI : public UI, bool fPluginHasEmbedUI; bool fPluginHasFileOpen; bool fPluginHasOutputParameters; + bool fPluginIsBridge; bool fPluginRunning; bool fPluginWillRunInBridgeMode; Mutex fPluginsMutex; @@ -185,7 +187,7 @@ class IldaeilUI : public UI, bool fPluginSearchFirstShow; char fPluginSearchString[0xff]; - String fPopupError, fPluginFilename; + String fPopupError, fPluginFilename, fDiscoveryTool; Size fNextSize; struct RunnerData { @@ -216,6 +218,7 @@ public: fIdleState(kIdleInit), fPlugin((IldaeilBasePlugin*)getPluginInstancePointer()), fPluginHostWindow(getWindow(), this), + fBinaryType(BINARY_NATIVE), fPluginType(PLUGIN_LV2), fNextPluginType(fPluginType), fPluginId(0), @@ -224,6 +227,7 @@ public: fPluginHasEmbedUI(false), fPluginHasFileOpen(false), fPluginHasOutputParameters(false), + fPluginIsBridge(false), fPluginRunning(false), fPluginWillRunInBridgeMode(false), fCurrentPluginInfo(), @@ -344,6 +348,8 @@ public: #endif fPluginHasFileOpen = false; } + + fPluginIsBridge = hints & PLUGIN_IS_BRIDGE; } void projectLoadedFromDSP() @@ -810,12 +816,28 @@ protected: } d_stdout("Will scan plugins now..."); - fRunnerData.handle = carla_plugin_discovery_start(fPlugin->fDiscoveryTool, - fPluginType, - IldaeilBasePlugin::getPluginPath(fPluginType), - _binaryPluginSearchCallback, - _binaryPluginCheckCacheCallback, - this); + + const String& binaryPath(fPlugin->fBinaryPath); + + if (binaryPath.isNotEmpty()) + { + fBinaryType = BINARY_NATIVE; + + fDiscoveryTool = binaryPath; + fDiscoveryTool += DISTRHO_OS_SEP_STR "carla-discovery-native"; + #ifdef CARLA_OS_WIN + fDiscoveryTool += ".exe"; + #endif + + fRunnerData.handle = carla_plugin_discovery_start(fDiscoveryTool, + fBinaryType, + fPluginType, + IldaeilBasePlugin::getPluginPath(fPluginType), + _binaryPluginSearchCallback, + _binaryPluginCheckCacheCallback, + this); + + } if (fDrawingState == kDrawingLoading) { @@ -823,7 +845,7 @@ protected: fPluginSearchFirstShow = true; } - if (fRunnerData.handle == nullptr) + if (binaryPath.isEmpty() || (fRunnerData.handle == nullptr && !startNextDiscovery())) { d_stdout("Nothing found!"); return false; @@ -836,11 +858,103 @@ protected: return true; // stop here - d_stdout("Found %lu plugins!", (ulong)fPlugins.size()); carla_plugin_discovery_stop(fRunnerData.handle); fRunnerData.handle = nullptr; + if (startNextDiscovery()) + return true; + + d_stdout("Found %lu plugins!", (ulong)fPlugins.size()); + return false; + } + + bool startNextDiscovery() + { + if (! setNextDiscoveryTool()) + return false; + + fRunnerData.handle = carla_plugin_discovery_start(fDiscoveryTool, + fBinaryType, + fPluginType, + IldaeilBasePlugin::getPluginPath(fPluginType), + _binaryPluginSearchCallback, + _binaryPluginCheckCacheCallback, + this); + + if (fRunnerData.handle == nullptr) + return startNextDiscovery(); + + return true; + } + + bool setNextDiscoveryTool() + { + switch (fPluginType) + { + case PLUGIN_VST2: + case PLUGIN_VST3: + case PLUGIN_CLAP: + break; + default: + return false; + } + + #ifdef CARLA_OS_WIN + #ifdef CARLA_OS_WIN64 + // look for win32 plugins on win64 + if (fBinaryType == BINARY_NATIVE) + { + fBinaryType = BINARY_WIN32; + fDiscoveryTool = fPlugin->fBinaryPath; + fDiscoveryTool += CARLA_OS_SEP_STR "carla-discovery-win32.exe"; + + if (water::File(fDiscoveryTool.buffer()).existsAsFile()) + return true; + } + #endif + + // no other types to try return false; + #else // CARLA_OS_WIN + + #ifndef CARLA_OS_MAC + // try 32bit plugins on 64bit systems, skipping macOS where 32bit is no longer supported + if (fBinaryType == BINARY_NATIVE) + { + fBinaryType = BINARY_POSIX32; + fDiscoveryTool = fPlugin->fBinaryPath; + fDiscoveryTool += CARLA_OS_SEP_STR "carla-discovery-posix32"; + + if (water::File(fDiscoveryTool.buffer()).existsAsFile()) + return true; + } + #endif + + // try wine bridges + #ifdef CARLA_OS_64BIT + if (fBinaryType == BINARY_NATIVE || fBinaryType == BINARY_POSIX32) + { + fBinaryType = BINARY_WIN64; + fDiscoveryTool = fPlugin->fBinaryPath; + fDiscoveryTool += CARLA_OS_SEP_STR "carla-discovery-win64.exe"; + + if (water::File(fDiscoveryTool.buffer()).existsAsFile()) + return true; + } + #endif + + if (fBinaryType != BINARY_WIN32) + { + fBinaryType = BINARY_WIN32; + fDiscoveryTool = fPlugin->fBinaryPath; + fDiscoveryTool += CARLA_OS_SEP_STR "carla-discovery-win32.exe"; + + if (water::File(fDiscoveryTool.buffer()).existsAsFile()) + return true; + } + + return false; + #endif // CARLA_OS_WIN } void binaryPluginSearchCallback(const CarlaPluginDiscoveryInfo* const info, const char* const sha1sum) @@ -1279,6 +1393,23 @@ protected: { const CarlaHostHandle handle = fPlugin->fCarlaHostHandle; + if (fPluginIsBridge) + { + const bool active = carla_get_internal_parameter_value(handle, 0, PARAMETER_ACTIVE) > 0.5f; + + if (active) + { + ImGui::BeginDisabled(); + ImGui::Button("Reload bridge"); + ImGui::EndDisabled(); + } + else + { + if (ImGui::Button("Reload bridge")) + carla_set_active(handle, 0, true); + } + } + if (ui->presetCount != 0) { ImGui::Text("Preset:"); diff --git a/plugins/Standalone/macOS/Info.plist b/plugins/Standalone/macOS/Info.plist index 685df7f..e86107b 100644 --- a/plugins/Standalone/macOS/Info.plist +++ b/plugins/Standalone/macOS/Info.plist @@ -9,7 +9,14 @@ CFBundleIconFile distrho.icns CFBundleIdentifier - Ildaeil + studio.kx.distrho.ildaeil + CFBundleShortVersionString + 1.3 + LSMinimumSystemVersion + 10.8 + NSHumanReadableCopyright + (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 published by the Free Software Foundation; either version 3 of the License, or any later version. NSHighResolutionCapable NSRequiresAquaSystemAppearance