From ed0a04a11c7a6508b0dc8871ff8b24f7aa733157 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 21 May 2022 22:16:12 +0100 Subject: [PATCH] Update to Rack 2.1.1 Signed-off-by: falkTX --- src/CardinalPlugin.cpp | 3 ++ src/Rack | 2 +- src/override/common.cpp | 2 +- src/override/diffs/MenuBar.cpp.diff | 2 +- src/override/diffs/Model.cpp.diff | 2 +- src/override/diffs/Window.cpp.diff | 2 +- src/override/diffs/common.cpp.diff | 4 +- src/override/diffs/plugin.cpp.diff | 77 ++++++++++++++++++++--------- src/override/plugin.cpp | 4 ++ 9 files changed, 67 insertions(+), 31 deletions(-) diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index b37aac1..7b51812 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -248,6 +248,9 @@ struct Initializer INFO("Destroying plugins"); plugin::destroyStaticPlugins(); + INFO("Destroying settings"); + settings::destroy(); + INFO("Destroying logger"); logger::destroy(); } diff --git a/src/Rack b/src/Rack index 30665d6..b016cac 160000 --- a/src/Rack +++ b/src/Rack @@ -1 +1 @@ -Subproject commit 30665d62801c2ced7260a37a2d0214edfe6528a9 +Subproject commit b016cacb10c4fd66d814b924bc2774242f74c836 diff --git a/src/override/common.cpp b/src/override/common.cpp index c1c9e70..200ecad 100644 --- a/src/override/common.cpp +++ b/src/override/common.cpp @@ -50,7 +50,7 @@ const std::string APP_NAME = "Cardinal"; const std::string APP_EDITION = getPluginFormatName(); const std::string APP_EDITION_NAME = "Audio Plugin"; const std::string APP_VERSION_MAJOR = "2"; -const std::string APP_VERSION = "2.1"; +const std::string APP_VERSION = "2.1.1"; #if defined ARCH_WIN const std::string APP_OS = "win"; #elif defined ARCH_MAC diff --git a/src/override/diffs/MenuBar.cpp.diff b/src/override/diffs/MenuBar.cpp.diff index d4b9535..36c6868 100644 --- a/src/override/diffs/MenuBar.cpp.diff +++ b/src/override/diffs/MenuBar.cpp.diff @@ -1,5 +1,5 @@ --- ../Rack/src/app/MenuBar.cpp 2022-02-26 23:08:06.697192725 +0000 -+++ MenuBar.cpp 2022-04-27 17:30:16.653341980 +0100 ++++ MenuBar.cpp 2022-04-27 18:17:16.790097058 +0100 @@ -1,8 +1,33 @@ +/* + * DISTRHO Cardinal Plugin diff --git a/src/override/diffs/Model.cpp.diff b/src/override/diffs/Model.cpp.diff index 50c8817..fa36753 100644 --- a/src/override/diffs/Model.cpp.diff +++ b/src/override/diffs/Model.cpp.diff @@ -1,5 +1,5 @@ --- ../Rack/src/plugin/Model.cpp 2021-10-17 13:57:23.257633662 +0100 -+++ Model.cpp 2022-04-27 17:55:57.362107553 +0100 ++++ Model.cpp 2022-04-27 18:17:16.790097058 +0100 @@ -1,3 +1,30 @@ +/* + * DISTRHO Cardinal Plugin diff --git a/src/override/diffs/Window.cpp.diff b/src/override/diffs/Window.cpp.diff index 0f6d5bf..72bab0a 100644 --- a/src/override/diffs/Window.cpp.diff +++ b/src/override/diffs/Window.cpp.diff @@ -1,5 +1,5 @@ --- ../Rack/src/window/Window.cpp 2022-02-09 15:35:19.238863170 +0000 -+++ Window.cpp 2022-04-27 16:53:59.743671091 +0100 ++++ Window.cpp 2022-05-15 12:05:26.430956655 +0100 @@ -1,33 +1,83 @@ +/* + * DISTRHO Cardinal Plugin diff --git a/src/override/diffs/common.cpp.diff b/src/override/diffs/common.cpp.diff index ac85f16..6ceca14 100644 --- a/src/override/diffs/common.cpp.diff +++ b/src/override/diffs/common.cpp.diff @@ -1,5 +1,5 @@ --- ../Rack/src/common.cpp 2021-11-23 19:57:23.719015894 +0000 -+++ common.cpp 2022-03-14 23:25:17.492322806 +0000 ++++ common.cpp 2022-05-21 22:13:36.682680714 +0100 @@ -1,6 +1,38 @@ +/* + * DISTRHO Cardinal Plugin @@ -52,7 +52,7 @@ +const std::string APP_EDITION_NAME = "Audio Plugin"; const std::string APP_VERSION_MAJOR = "2"; -const std::string APP_VERSION = TOSTRING(_APP_VERSION); -+const std::string APP_VERSION = "2.1"; ++const std::string APP_VERSION = "2.1.1"; #if defined ARCH_WIN const std::string APP_OS = "win"; -#elif ARCH_MAC diff --git a/src/override/diffs/plugin.cpp.diff b/src/override/diffs/plugin.cpp.diff index 73c7cb7..bbf3a71 100644 --- a/src/override/diffs/plugin.cpp.diff +++ b/src/override/diffs/plugin.cpp.diff @@ -1,6 +1,6 @@ ---- ../Rack/src/plugin.cpp 2022-02-05 22:30:09.265393248 +0000 -+++ plugin.cpp 2022-01-30 00:24:49.375329910 +0000 -@@ -1,308 +1,40 @@ +--- ../Rack/src/plugin.cpp 2022-05-21 22:03:14.887288742 +0100 ++++ plugin.cpp 2022-05-21 22:14:18.180931534 +0100 +@@ -1,336 +1,41 @@ -#include -#include -#include @@ -72,6 +72,18 @@ -// private API -//////////////////// - +- +-static void* getSymbol(void* handle, const char* name) { +- if (!handle) +- return NULL; +- +-#if defined ARCH_WIN +- return (void*) GetProcAddress((HMODULE) handle, name); +-#else +- return dlsym(handle, name); +-#endif +-} +- -/** Returns library handle */ -static void* loadLibrary(std::string libraryPath) { -#if defined ARCH_WIN @@ -131,12 +143,7 @@ - plugin->handle = loadLibrary(libraryPath); - - // Get plugin's init() function -- InitCallback initCallback; --#if defined ARCH_WIN -- initCallback = (InitCallback) GetProcAddress((HMODULE) plugin->handle, "init"); --#else -- initCallback = (InitCallback) dlsym(plugin->handle, "init"); --#endif +- InitCallback initCallback = (InitCallback) getSymbol(plugin->handle, "init"); - if (!initCallback) - throw Exception("Failed to read init() symbol in %s", libraryPath.c_str()); - @@ -183,6 +190,14 @@ - throw Exception("JSON parsing error at %s %d:%d %s", manifestFilename.c_str(), error.line, error.column, error.text); - DEFER({json_decref(rootJ);}); - +- // Load manifest +- plugin->fromJson(rootJ); +- +- // Reject plugin if slug already exists +- Plugin* existingPlugin = getPlugin(plugin->slug); +- if (existingPlugin) +- throw Exception("Plugin %s is already loaded, not attempting to load it again", plugin->slug.c_str()); +- - // Call init callback - InitCallback initCallback; - if (path == "") { @@ -193,13 +208,18 @@ - } - initCallback(plugin); - -- // Load manifest -- plugin->fromJson(rootJ); +- // Load modules manifest +- json_t* modulesJ = json_object_get(rootJ, "modules"); +- plugin->modulesFromJson(modulesJ); - -- // Reject plugin if slug already exists -- Plugin* existingPlugin = getPlugin(plugin->slug); -- if (existingPlugin) -- throw Exception("Plugin %s is already loaded, not attempting to load it again", plugin->slug.c_str()); +- // Call settingsFromJson() if exists +- // Returns NULL for Core. +- auto settingsFromJson = (decltype(&::settingsFromJson)) getSymbol(plugin->handle, "settingsFromJson"); +- if (settingsFromJson) { +- json_t* settingsJ = json_object_get(settings::pluginSettingsJ, plugin->slug.c_str()); +- if (settingsJ) +- settingsFromJson(settingsJ); +- } - } - catch (Exception& e) { - WARN("Could not load plugin %s: %s", path.c_str(), e.what()); @@ -296,11 +316,7 @@ - typedef void (*DestroyCallback)(); - DestroyCallback destroyCallback = NULL; - if (handle) { --#if defined ARCH_WIN -- destroyCallback = (DestroyCallback) GetProcAddress((HMODULE) handle, "destroy"); --#else -- destroyCallback = (DestroyCallback) dlsym(handle, "destroy"); --#endif +- destroyCallback = (DestroyCallback) getSymbol(handle, "destroy"); - } - if (destroyCallback) { - try { @@ -334,10 +350,23 @@ -} - - +-void settingsMergeJson(json_t* rootJ) { +- for (Plugin* plugin : plugins) { +- auto settingsToJson = (decltype(&::settingsToJson)) getSymbol(plugin->handle, "settingsToJson"); +- if (settingsToJson) { +- json_t* settingsJ = settingsToJson(); +- json_object_set_new(rootJ, plugin->slug.c_str(), settingsJ); +- } +- else { +- json_object_del(rootJ, plugin->slug.c_str()); +- } +- } +-} ++void settingsMergeJson(json_t*) {} + + /** Given slug => fallback slug. - Correctly handles bidirectional fallbacks. - To request fallback slugs to be added to this list, open a GitHub issue. -@@ -352,8 +84,19 @@ +@@ -383,8 +88,19 @@ */ using PluginModuleSlug = std::tuple; static const std::map moduleSlugFallbacks = { @@ -358,7 +387,7 @@ // {{"", ""}, {"", ""}}, }; -@@ -441,7 +184,6 @@ +@@ -472,7 +188,6 @@ } diff --git a/src/override/plugin.cpp b/src/override/plugin.cpp index 76d10aa..a23b26c 100644 --- a/src/override/plugin.cpp +++ b/src/override/plugin.cpp @@ -35,6 +35,9 @@ namespace rack { namespace plugin { +void settingsMergeJson(json_t*) {} + + /** Given slug => fallback slug. Correctly handles bidirectional fallbacks. To request fallback slugs to be added to this list, open a GitHub issue. @@ -43,6 +46,7 @@ static const std::map pluginSlugFallbacks = { {"VultModulesFree", "VultModules"}, {"VultModules", "VultModulesFree"}, {"AudibleInstrumentsPreview", "AudibleInstruments"}, + {"SequelSequencers", "DanielDavies"}, // {"", ""}, };