regen Rack patch diffs

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2023-08-28 09:56:27 +02:00
parent bf3fa93a80
commit 3ede7c2b05
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
13 changed files with 180 additions and 132 deletions

View file

@ -324,13 +324,13 @@ void WindowSetPluginRemote(Window* const window, NanoTopLevelWidget* const tlw)
// Init settings // Init settings
WindowParametersRestore(window); WindowParametersRestore(window);
widget::Widget::ContextCreateEvent e; widget::Widget::ContextCreateEvent e = {};
e.vg = window->vg; e.vg = window->vg;
APP->scene->onContextCreate(e); APP->scene->onContextCreate(e);
} }
else else
{ {
widget::Widget::ContextDestroyEvent e; widget::Widget::ContextDestroyEvent e = {};
e.vg = window->vg; e.vg = window->vg;
APP->scene->onContextDestroy(e); APP->scene->onContextDestroy(e);
@ -437,13 +437,13 @@ void WindowSetPluginUI(Window* const window, CardinalBaseUI* const ui)
// Init settings // Init settings
WindowParametersRestore(window); WindowParametersRestore(window);
widget::Widget::ContextCreateEvent e; widget::Widget::ContextCreateEvent e = {};
e.vg = window->vg; e.vg = window->vg;
APP->scene->onContextCreate(e); APP->scene->onContextCreate(e);
} }
else else
{ {
widget::Widget::ContextDestroyEvent e; widget::Widget::ContextDestroyEvent e = {};
e.vg = window->vg; e.vg = window->vg;
APP->scene->onContextDestroy(e); APP->scene->onContextDestroy(e);

View file

@ -1,5 +1,5 @@
--- ../Rack/src/engine/Engine.cpp 2023-06-11 21:02:02.644002965 +0200 --- ../Rack/src/engine/Engine.cpp 2023-05-20 17:03:33.006081772 +0200
+++ Engine.cpp 2023-06-11 20:56:09.472002797 +0200 +++ Engine.cpp 2023-05-22 04:26:39.902464764 +0200
@@ -1,3 +1,30 @@ @@ -1,3 +1,30 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin

View file

@ -1,5 +1,5 @@
--- ../Rack/src/app/MenuBar.cpp 2023-06-11 21:02:02.640002965 +0200 --- ../Rack/src/app/MenuBar.cpp 2023-05-20 17:03:33.005081737 +0200
+++ MenuBar.cpp 2023-07-11 19:18:16.204016531 +0200 +++ MenuBar.cpp 2023-08-15 17:56:23.782915145 +0200
@@ -1,8 +1,33 @@ @@ -1,8 +1,33 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin
@ -44,12 +44,13 @@
#include <window/Window.hpp> #include <window/Window.hpp>
#include <asset.hpp> #include <asset.hpp>
#include <context.hpp> #include <context.hpp>
@@ -25,8 +51,28 @@ @@ -25,8 +51,29 @@
#include <patch.hpp> #include <patch.hpp>
#include <library.hpp> #include <library.hpp>
+#include "../CardinalCommon.hpp" +#include "../CardinalCommon.hpp"
+#include "../CardinalRemote.hpp" +#include "../CardinalRemote.hpp"
+#include "../PluginContext.hpp"
+#include "DistrhoPlugin.hpp" +#include "DistrhoPlugin.hpp"
+#include "DistrhoStandaloneUtils.hpp" +#include "DistrhoStandaloneUtils.hpp"
+ +
@ -73,7 +74,7 @@
namespace app { namespace app {
namespace menuBar { namespace menuBar {
@@ -48,79 +94,238 @@ @@ -48,79 +95,238 @@
}; };
@ -349,7 +350,7 @@
} }
}; };
@@ -166,7 +371,7 @@ @@ -166,7 +372,7 @@
menu->addChild(new ui::MenuSeparator); menu->addChild(new ui::MenuSeparator);
@ -358,7 +359,7 @@
} }
}; };
@@ -256,7 +461,7 @@ @@ -256,7 +462,7 @@
return settings::cableTension; return settings::cableTension;
} }
float getDefaultValue() override { float getDefaultValue() override {
@ -367,7 +368,7 @@
} }
float getDisplayValue() override { float getDisplayValue() override {
return getValue() * 100; return getValue() * 100;
@@ -393,49 +598,39 @@ @@ -393,49 +599,39 @@
}; };
@ -442,7 +443,7 @@
menu->addChild(createBoolPtrMenuItem("Show tooltips", "", &settings::tooltips)); menu->addChild(createBoolPtrMenuItem("Show tooltips", "", &settings::tooltips));
@@ -460,9 +655,18 @@ @@ -460,9 +656,18 @@
menu->addChild(haloBrightnessSlider); menu->addChild(haloBrightnessSlider);
menu->addChild(new ui::MenuSeparator); menu->addChild(new ui::MenuSeparator);
@ -461,7 +462,7 @@
static const std::vector<std::string> knobModeLabels = { static const std::vector<std::string> knobModeLabels = {
"Linear", "Linear",
@@ -487,11 +691,34 @@ @@ -487,11 +692,34 @@
menu->addChild(knobScrollSensitivitySlider); menu->addChild(knobScrollSensitivitySlider);
menu->addChild(new ui::MenuSeparator); menu->addChild(new ui::MenuSeparator);
@ -499,7 +500,7 @@
} }
}; };
@@ -501,47 +728,6 @@ @@ -501,48 +729,11 @@
//////////////////// ////////////////////
@ -545,9 +546,14 @@
- -
- -
struct EngineButton : MenuButton { struct EngineButton : MenuButton {
+#ifdef HAVE_LIBLO
+ bool remoteServerStarted = false;
+#endif
+
void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
@@ -555,268 +741,46 @@ menu->cornerFlags = BND_CORNER_TOP;
@@ -555,269 +746,87 @@
settings::cpuMeter ^= true; settings::cpuMeter ^= true;
})); }));
@ -558,10 +564,7 @@
- int cores = system::getLogicalCoreCount() / 2; - int cores = system::getLogicalCoreCount() / 2;
- -
- for (int i = 1; i <= 2 * cores; i++) { - for (int i = 1; i <= 2 * cores; i++) {
+ if (isUsingNativeAudio()) { - std::string rightText;
+ if (supportsAudioInput()) {
+ const bool enabled = isAudioInputEnabled();
std::string rightText;
- if (i == cores) - if (i == cores)
- rightText += "(most modules)"; - rightText += "(most modules)";
- else if (i == 1) - else if (i == 1)
@ -693,17 +696,24 @@
- plugin::Plugin* p = plugin::getPlugin(slug); - plugin::Plugin* p = plugin::getPlugin(slug);
- if (p) { - if (p) {
- rightText += p->version + " → "; - rightText += p->version + " → ";
- } +#ifdef HAVE_LIBLO
+ if (isStandalone()) {
+ CardinalPluginContext* const context = static_cast<CardinalPluginContext*>(APP);
+ CardinalBasePlugin* const plugin = static_cast<CardinalBasePlugin*>(context->plugin);
+
+ // const bool remoteServerStarted = this->remoteServerStarted;
+ const std::string remoteControlText = remoteServerStarted ? " " CHECKMARK_STRING : "";
+
+ menu->addChild(createMenuItem("Enable OSC remote control", remoteControlText, [=]() {
+ if (remoteServerStarted) {
+ remoteServerStarted = false;
+ plugin->stopRemoteServer();
+ return;
}
- rightText += update.version; - rightText += update.version;
+ if (enabled) - }
+ rightText = CHECKMARK_STRING;
+ menu->addChild(createMenuItem("Enable Audio Input", rightText, [enabled]() {
+ if (!enabled)
+ requestAudioInput();
+ }));
}
- } - }
-
- MenuItem::step(); - MenuItem::step();
- } - }
- -
@ -715,8 +725,13 @@
- e.unconsume(); - e.unconsume();
- } - }
-}; -};
- + async_dialog_text_input("OSC network port", CARDINAL_DEFAULT_REMOTE_PORT, [=](char* const port) {
- + if (port == nullptr)
+ return;
+ if (plugin->startRemoteServer(port))
+ remoteServerStarted = true;
-struct LibraryMenu : ui::Menu { -struct LibraryMenu : ui::Menu {
- LibraryMenu() { - LibraryMenu() {
- refresh(); - refresh();
@ -741,8 +756,12 @@
- else if (!library::isLoggedIn()) { - else if (!library::isLoggedIn()) {
- addChild(createMenuItem("Register VCV account", "", [=]() { - addChild(createMenuItem("Register VCV account", "", [=]() {
- system::openBrowser("https://vcvrack.com/login"); - system::openBrowser("https://vcvrack.com/login");
- })); + std::free(port);
- + });
}));
+ }
+#endif
- ui::TextField* emailField = new ui::TextField; - ui::TextField* emailField = new ui::TextField;
- emailField->placeholder = "Email"; - emailField->placeholder = "Email";
- emailField->box.size.x = 240.0; - emailField->box.size.x = 240.0;
@ -765,10 +784,29 @@
- addChild(createMenuItem("Log out", "", [=]() { - addChild(createMenuItem("Log out", "", [=]() {
- library::logOut(); - library::logOut();
- })); - }));
- + if (isUsingNativeAudio()) {
+ if (supportsAudioInput()) {
+ const bool enabled = isAudioInputEnabled();
+ std::string rightText;
+ if (enabled)
+ rightText = CHECKMARK_STRING;
+ menu->addChild(createMenuItem("Enable Audio Input", rightText, [enabled]() {
+ if (!enabled)
+ requestAudioInput();
+ }));
+ }
- addChild(createMenuItem("Browse VCV Library", "", [=]() { - addChild(createMenuItem("Browse VCV Library", "", [=]() {
- system::openBrowser("https://library.vcvrack.com/"); - system::openBrowser("https://library.vcvrack.com/");
- })); - }));
+ if (supportsMIDI()) {
+ std::string rightText;
+ if (isMIDIEnabled())
+ rightText = CHECKMARK_STRING;
+ menu->addChild(createMenuItem("Enable/Reconnect MIDI", rightText, []() {
+ requestMIDI();
+ }));
+ }
- SyncUpdatesItem* syncItem = new SyncUpdatesItem; - SyncUpdatesItem* syncItem = new SyncUpdatesItem;
- syncItem->text = "Update all"; - syncItem->text = "Update all";
@ -783,48 +821,6 @@
- updateItem->setUpdate(pair.first); - updateItem->setUpdate(pair.first);
- addChild(updateItem); - addChild(updateItem);
- } - }
+ if (supportsMIDI()) {
+ std::string rightText;
+ if (isMIDIEnabled())
+ rightText = CHECKMARK_STRING;
+ menu->addChild(createMenuItem("Enable/Reconnect MIDI", rightText, []() {
+ requestMIDI();
+ }));
}
- }
- }
-};
-
-
-struct LibraryButton : MenuButton {
- NotificationIcon* notification;
- LibraryButton() {
- notification = new NotificationIcon;
- addChild(notification);
- }
-
- void onAction(const ActionEvent& e) override {
- ui::Menu* menu = createMenu<LibraryMenu>();
- menu->cornerFlags = BND_CORNER_TOP;
- menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
- // Check for updates when menu is opened
- std::thread t([&]() {
- system::setThreadName("Library");
- library::checkUpdates();
- });
- t.detach();
- }
-
- void step() override {
- notification->box.pos = math::Vec(0, 0);
- notification->visible = library::hasUpdates();
-
- // Popup when updates finish downloading
- if (library::restartRequested) {
- library::restartRequested = false;
- if (osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "All plugins have been downloaded. Close and re-launch Rack to load new updates.")) {
- APP->window->close();
+ if (supportsBufferSizeChanges()) { + if (supportsBufferSizeChanges()) {
+ static const std::vector<uint32_t> bufferSizes = { + static const std::vector<uint32_t> bufferSizes = {
+ #ifdef DISTRHO_OS_WASM + #ifdef DISTRHO_OS_WASM
@ -844,12 +840,55 @@
+ })); + }));
} }
} }
}
-};
-
-
-struct LibraryButton : MenuButton {
- NotificationIcon* notification;
-
- LibraryButton() {
- notification = new NotificationIcon;
- addChild(notification);
- }
-
- void onAction(const ActionEvent& e) override {
- ui::Menu* menu = createMenu<LibraryMenu>();
- menu->cornerFlags = BND_CORNER_TOP;
- menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
- // Check for updates when menu is opened
- std::thread t([&]() {
- system::setThreadName("Library");
- library::checkUpdates();
- });
- t.detach();
- }
+#ifdef HAVE_LIBLO
void step() override {
- notification->box.pos = math::Vec(0, 0);
- notification->visible = library::hasUpdates();
+ MenuButton::step();
- // Popup when updates finish downloading
- if (library::restartRequested) {
- library::restartRequested = false;
- if (osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "All plugins have been downloaded. Close and re-launch Rack to load new updates.")) {
- APP->window->close();
- }
+ if (remoteServerStarted) {
+ CardinalPluginContext* const context = static_cast<CardinalPluginContext*>(APP);
+ CardinalBasePlugin* const plugin = static_cast<CardinalBasePlugin*>(context->plugin);
+ plugin->stepRemoteServer();
}
- -
- MenuButton::step(); - MenuButton::step();
} }
+#endif
}; };
@@ -827,63 +791,30 @@
@@ -827,63 +836,30 @@
struct HelpButton : MenuButton { struct HelpButton : MenuButton {
@ -867,14 +906,14 @@
- menu->addChild(createMenuItem("Tips", "", [=]() { - menu->addChild(createMenuItem("Tips", "", [=]() {
- APP->scene->addChild(tipWindowCreate()); - APP->scene->addChild(tipWindowCreate());
- }));
-
- menu->addChild(createMenuItem("User manual", "F1", [=]() {
- system::openBrowser("https://vcvrack.com/manual");
+ menu->addChild(createMenuItem("Rack User manual", "F1", [=]() { + menu->addChild(createMenuItem("Rack User manual", "F1", [=]() {
+ patchUtils::openBrowser("https://vcvrack.com/manual"); + patchUtils::openBrowser("https://vcvrack.com/manual");
})); }));
- menu->addChild(createMenuItem("User manual", "F1", [=]() {
- system::openBrowser("https://vcvrack.com/manual");
- }));
-
- menu->addChild(createMenuItem("Support", "", [=]() { - menu->addChild(createMenuItem("Support", "", [=]() {
- system::openBrowser("https://vcvrack.com/support"); - system::openBrowser("https://vcvrack.com/support");
- })); - }));
@ -921,7 +960,7 @@
} }
}; };
@@ -926,15 +857,19 @@ @@ -926,15 +902,19 @@
text = ""; text = "";
@ -944,7 +983,7 @@
Label::step(); Label::step();
} }
@@ -944,7 +879,9 @@ @@ -944,7 +924,9 @@
struct MenuBar : widget::OpaqueWidget { struct MenuBar : widget::OpaqueWidget {
InfoLabel* infoLabel; InfoLabel* infoLabel;
@ -955,7 +994,7 @@
const float margin = 5; const float margin = 5;
box.size.y = BND_WIDGET_HEIGHT + 2 * margin; box.size.y = BND_WIDGET_HEIGHT + 2 * margin;
@@ -953,7 +890,7 @@ @@ -953,7 +935,7 @@
layout->spacing = math::Vec(0, 0); layout->spacing = math::Vec(0, 0);
addChild(layout); addChild(layout);
@ -964,7 +1003,7 @@
fileButton->text = "File"; fileButton->text = "File";
layout->addChild(fileButton); layout->addChild(fileButton);
@@ -965,13 +902,11 @@ @@ -965,13 +947,11 @@
viewButton->text = "View"; viewButton->text = "View";
layout->addChild(viewButton); layout->addChild(viewButton);
@ -980,7 +1019,7 @@
HelpButton* helpButton = new HelpButton; HelpButton* helpButton = new HelpButton;
helpButton->text = "Help"; helpButton->text = "Help";
@@ -1003,7 +938,7 @@ @@ -1003,7 +983,7 @@
widget::Widget* createMenuBar() { widget::Widget* createMenuBar() {

View file

@ -1,5 +1,5 @@
--- ../Rack/src/plugin/Model.cpp 2023-06-11 21:02:02.644002965 +0200 --- ../Rack/src/plugin/Model.cpp 2023-05-20 17:03:33.007081806 +0200
+++ Model.cpp 2023-06-11 20:56:09.472002797 +0200 +++ Model.cpp 2023-05-20 18:29:51.484669742 +0200
@@ -1,3 +1,30 @@ @@ -1,3 +1,30 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin

View file

@ -1,5 +1,5 @@
--- ../Rack/src/app/ModuleWidget.cpp 2023-06-11 21:02:02.640002965 +0200 --- ../Rack/src/app/ModuleWidget.cpp 2023-05-20 17:03:33.005081737 +0200
+++ ModuleWidget.cpp 2023-06-11 20:56:09.476002797 +0200 +++ ModuleWidget.cpp 2023-05-20 18:40:08.948302802 +0200
@@ -1,8 +1,35 @@ @@ -1,8 +1,35 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin

View file

@ -1,5 +1,5 @@
--- ../Rack/src/widget/OpenGlWidget.cpp 2023-06-11 21:02:02.644002965 +0200 --- ../Rack/src/widget/OpenGlWidget.cpp 2022-09-21 20:49:12.201540766 +0200
+++ OpenGlWidget.cpp 2023-06-11 20:56:09.476002797 +0200 +++ OpenGlWidget.cpp 2023-05-20 18:41:22.249200486 +0200
@@ -1,3 +1,30 @@ @@ -1,3 +1,30 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin

View file

@ -1,5 +1,5 @@
--- ../Rack/src/app/Scene.cpp 2023-06-11 21:02:02.640002965 +0200 --- ../Rack/src/app/Scene.cpp 2022-09-21 20:49:12.199540706 +0200
+++ Scene.cpp 2023-06-11 20:56:09.476002797 +0200 +++ Scene.cpp 2023-07-03 09:30:14.548718644 +0200
@@ -1,12 +1,36 @@ @@ -1,12 +1,36 @@
-#include <thread> -#include <thread>
- -

View file

@ -1,5 +1,5 @@
--- ../Rack/src/window/Window.cpp 2023-06-11 21:02:02.648002965 +0200 --- ../Rack/src/window/Window.cpp 2023-05-20 17:03:33.007081806 +0200
+++ Window.cpp 2023-07-13 17:01:53.848000425 +0200 +++ Window.cpp 2023-08-28 09:55:57.292032175 +0200
@@ -1,33 +1,94 @@ @@ -1,33 +1,94 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin
@ -119,7 +119,7 @@
throw Exception("Failed to load font %s", filename.c_str()); throw Exception("Failed to load font %s", filename.c_str());
} }
INFO("Loaded font %s", filename.c_str()); INFO("Loaded font %s", filename.c_str());
@@ -79,338 +139,475 @@ @@ -79,338 +139,478 @@
} }
@ -141,7 +141,7 @@
- int lastWindowY = 0; - int lastWindowY = 0;
- int lastWindowWidth = 0; - int lastWindowWidth = 0;
- int lastWindowHeight = 0; - int lastWindowHeight = 0;
+ DISTRHO_NAMESPACE::UI* ui = nullptr; + CardinalBaseUI* ui = nullptr;
+ DGL_NAMESPACE::NanoTopLevelWidget* tlw = nullptr; + DGL_NAMESPACE::NanoTopLevelWidget* tlw = nullptr;
+ DISTRHO_NAMESPACE::WindowParameters params; + DISTRHO_NAMESPACE::WindowParameters params;
+ DISTRHO_NAMESPACE::WindowParametersCallback* callback = nullptr; + DISTRHO_NAMESPACE::WindowParametersCallback* callback = nullptr;
@ -410,12 +410,14 @@
- if (APP->event->handleText(APP->window->internal->lastMousePos, codepoint)) - if (APP->event->handleText(APP->window->internal->lastMousePos, codepoint))
- return; - return;
-} -}
+ widget::Widget::ContextCreateEvent e; + widget::Widget::ContextCreateEvent e = {};
+ e.vg = window->vg;
+ APP->scene->onContextCreate(e); + APP->scene->onContextCreate(e);
+ } + }
+ else + else
+ { + {
+ widget::Widget::ContextDestroyEvent e; + widget::Widget::ContextDestroyEvent e = {};
+ e.vg = window->vg;
+ APP->scene->onContextDestroy(e); + APP->scene->onContextDestroy(e);
+#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS +#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
@ -470,7 +472,7 @@
- std::vector<std::string> pathsVec; - std::vector<std::string> pathsVec;
- for (int i = 0; i < count; i++) { - for (int i = 0; i < count; i++) {
- pathsVec.push_back(paths[i]); - pathsVec.push_back(paths[i]);
+void WindowSetPluginUI(Window* const window, DISTRHO_NAMESPACE::UI* const ui) +void WindowSetPluginUI(Window* const window, CardinalBaseUI* const ui)
+{ +{
+ // if nanovg context failed, init only bare minimum + // if nanovg context failed, init only bare minimum
+ if (window->vg == nullptr) + if (window->vg == nullptr)
@ -643,12 +645,14 @@
- if (!vg) { - if (!vg) {
- osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Could not initialize NanoVG. Does your graphics card support OpenGL 2.0 or greater? If so, make sure you have the latest graphics drivers installed."); - osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Could not initialize NanoVG. Does your graphics card support OpenGL 2.0 or greater? If so, make sure you have the latest graphics drivers installed.");
- throw Exception("Could not initialize NanoVG"); - throw Exception("Could not initialize NanoVG");
+ widget::Widget::ContextCreateEvent e; + widget::Widget::ContextCreateEvent e = {};
+ e.vg = window->vg;
+ APP->scene->onContextCreate(e); + APP->scene->onContextCreate(e);
} }
+ else + else
+ { + {
+ widget::Widget::ContextDestroyEvent e; + widget::Widget::ContextDestroyEvent e = {};
+ e.vg = window->vg;
+ APP->scene->onContextDestroy(e); + APP->scene->onContextDestroy(e);
- // Load default Blendish font - // Load default Blendish font
@ -832,7 +836,8 @@
+ CardinalBaseUI* const ui = static_cast<CardinalBaseUI*>(context); + CardinalBaseUI* const ui = static_cast<CardinalBaseUI*>(context);
+ if (char* const screenshot = String::asBase64(data, size).getAndReleaseBuffer()) { + if (char* const screenshot = String::asBase64(data, size).getAndReleaseBuffer()) {
+ ui->setState("screenshot", screenshot); + ui->setState("screenshot", screenshot);
+ remoteUtils::sendScreenshotToRemote(ui->remoteDetails, screenshot); + if (ui->remoteDetails != nullptr)
+ remoteUtils::sendScreenshotToRemote(ui->remoteDetails, screenshot);
+ std::free(screenshot); + std::free(screenshot);
} }
} }
@ -841,15 +846,13 @@
void Window::step() { void Window::step() {
+ DISTRHO_SAFE_ASSERT_RETURN(internal->tlw != nullptr,); + if (internal->tlw == nullptr || vg == nullptr)
+
+ if (vg == nullptr)
+ return; + return;
+ +
double frameTime = system::getTime(); double frameTime = system::getTime();
if (std::isfinite(internal->frameTime)) { if (std::isfinite(internal->frameTime)) {
internal->lastFrameDuration = frameTime - internal->frameTime; internal->lastFrameDuration = frameTime - internal->frameTime;
@@ -422,57 +619,48 @@ @@ -422,57 +622,52 @@
// Make event handlers and step() have a clean NanoVG context // Make event handlers and step() have a clean NanoVG context
nvgReset(vg); nvgReset(vg);
@ -886,7 +889,11 @@
- glfwSetWindowTitle(win, windowTitle.c_str()); - glfwSetWindowTitle(win, windowTitle.c_str());
- internal->lastWindowTitle = windowTitle; - internal->lastWindowTitle = windowTitle;
+ if (isStandalone()) { + if (isStandalone()) {
+#if CARDINAL_VARIANT_MINI
+ std::string windowTitle = "Cardinal Mini";
+#else
+ std::string windowTitle = "Cardinal"; + std::string windowTitle = "Cardinal";
+#endif
+ if (APP->patch->path != "") { + if (APP->patch->path != "") {
+ windowTitle += " - "; + windowTitle += " - ";
+ if (!APP->history->isSaved()) + if (!APP->history->isSaved())
@ -938,7 +945,7 @@
windowRatio = (float)fbWidth / winWidth; windowRatio = (float)fbWidth / winWidth;
// t1 = system::getTime(); // t1 = system::getTime();
@@ -486,10 +674,8 @@ @@ -486,10 +681,8 @@
// t2 = system::getTime(); // t2 = system::getTime();
// Render scene // Render scene
@ -950,7 +957,7 @@
nvgScale(vg, pixelRatio, pixelRatio); nvgScale(vg, pixelRatio, pixelRatio);
// Draw scene // Draw scene
@@ -500,23 +686,16 @@ @@ -500,23 +693,16 @@
// t3 = system::getTime(); // t3 = system::getTime();
glViewport(0, 0, fbWidth, fbHeight); glViewport(0, 0, fbWidth, fbHeight);
@ -978,14 +985,14 @@
// t5 = system::getTime(); // t5 = system::getTime();
// DEBUG("pre-step %6.1f step %6.1f draw %6.1f nvgEndFrame %6.1f glfwSwapBuffers %6.1f total %6.1f", // DEBUG("pre-step %6.1f step %6.1f draw %6.1f nvgEndFrame %6.1f glfwSwapBuffers %6.1f total %6.1f",
// (t1 - frameTime) * 1e3f, // (t1 - frameTime) * 1e3f,
@@ -526,163 +705,130 @@ @@ -526,163 +712,132 @@
// (t5 - t4) * 1e3f, // (t5 - t4) * 1e3f,
// (t5 - frameTime) * 1e3f // (t5 - frameTime) * 1e3f
// ); // );
- internal->frame++; - internal->frame++;
-} -}
+ ++internal->frame; + ++internal->frame;
+
+#ifdef CARDINAL_WINDOW_CAN_GENERATE_SCREENSHOTS +#ifdef CARDINAL_WINDOW_CAN_GENERATE_SCREENSHOTS
+ if (internal->generateScreenshotStep != kScreenshotStepNone) { + if (internal->generateScreenshotStep != kScreenshotStepNone) {
+ ++internal->generateScreenshotStep; + ++internal->generateScreenshotStep;
@ -998,6 +1005,9 @@
+ constexpr const int depth = 3; + constexpr const int depth = 3;
+#endif +#endif
+ // Allocate pixel color buffer
+ uint8_t* const pixels = new uint8_t[winHeight * winWidth * 4];
-static void flipBitmap(uint8_t* pixels, int width, int height, int depth) { -static void flipBitmap(uint8_t* pixels, int width, int height, int depth) {
- for (int y = 0; y < height / 2; y++) { - for (int y = 0; y < height / 2; y++) {
- int flipY = height - y - 1; - int flipY = height - y - 1;
@ -1005,9 +1015,6 @@
- std::memcpy(tmp, &pixels[y * width * depth], width * depth); - std::memcpy(tmp, &pixels[y * width * depth], width * depth);
- std::memcpy(&pixels[y * width * depth], &pixels[flipY * width * depth], width * depth); - std::memcpy(&pixels[y * width * depth], &pixels[flipY * width * depth], width * depth);
- std::memcpy(&pixels[flipY * width * depth], tmp, width * depth); - std::memcpy(&pixels[flipY * width * depth], tmp, width * depth);
+ // Allocate pixel color buffer
+ uint8_t* const pixels = new uint8_t[winHeight * winWidth * 4];
+
+ // glReadPixels defaults to GL_BACK, but the back-buffer is unstable, so use the front buffer (what the user sees) + // glReadPixels defaults to GL_BACK, but the back-buffer is unstable, so use the front buffer (what the user sees)
+ glReadBuffer(GL_FRONT); + glReadBuffer(GL_FRONT);
+ glReadPixels(0, 0, winWidth, winHeight, depth == 3 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE, pixels); + glReadPixels(0, 0, winWidth, winHeight, depth == 3 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE, pixels);
@ -1015,10 +1022,10 @@
+ if (internal->generateScreenshotStep == kScreenshotStepSaving) + if (internal->generateScreenshotStep == kScreenshotStepSaving)
+ { + {
+ // Write pixels to PNG + // Write pixels to PNG
+ const int stride = winWidth * depth;
+ uint8_t* const pixelsWithOffset = pixels + (stride * y);
+ Window__flipBitmap(pixels, winWidth, winHeight, depth); + Window__flipBitmap(pixels, winWidth, winHeight, depth);
+ winHeight -= y; + winHeight -= y;
+ const int stride = winWidth * depth;
+ uint8_t* const pixelsWithOffset = pixels + (stride * y);
+#ifdef STBI_WRITE_NO_STDIO +#ifdef STBI_WRITE_NO_STDIO
+ Window__downscaleBitmap(pixelsWithOffset, winWidth, winHeight); + Window__downscaleBitmap(pixelsWithOffset, winWidth, winHeight);
+ stbi_write_png_to_func(Window__writeImagePNG, internal->ui, + stbi_write_png_to_func(Window__writeImagePNG, internal->ui,
@ -1028,8 +1035,10 @@
+#endif +#endif
+ +
+ internal->generateScreenshotStep = kScreenshotStepNone; + internal->generateScreenshotStep = kScreenshotStepNone;
+#ifdef CARDINAL_TRANSPARENT_SCREENSHOTS
+ APP->scene->menuBar->show(); + APP->scene->menuBar->show();
+ APP->scene->rack->children.front()->show(); + APP->scene->rack->children.front()->show();
+#endif
+ } + }
+ +
+ delete[] pixels; + delete[] pixels;
@ -1218,7 +1227,7 @@
} }
@@ -702,7 +848,7 @@ @@ -702,7 +857,7 @@
double Window::getFrameDurationRemaining() { double Window::getFrameDurationRemaining() {
@ -1227,7 +1236,7 @@
return frameDuration - (system::getTime() - internal->frameTime); return frameDuration - (system::getTime() - internal->frameTime);
} }
@@ -713,14 +859,15 @@ @@ -713,14 +868,15 @@
return pair->second; return pair->second;
// Load font // Load font
@ -1246,7 +1255,7 @@
} }
internal->fontCache[filename] = font; internal->fontCache[filename] = font;
return font; return font;
@@ -733,14 +880,15 @@ @@ -733,14 +889,15 @@
return pair->second; return pair->second;
// Load image // Load image
@ -1265,7 +1274,7 @@
} }
internal->imageCache[filename] = image; internal->imageCache[filename] = image;
return image; return image;
@@ -757,28 +905,156 @@ @@ -757,28 +914,156 @@
} }

View file

@ -1,5 +1,5 @@
--- ../Rack/dep/oui-blendish/blendish.c 2023-06-11 21:02:28.136002978 +0200 --- ../Rack/dep/oui-blendish/blendish.c 2022-09-21 20:49:29.973066921 +0200
+++ blendish.c 2023-06-11 20:56:09.476002797 +0200 +++ blendish.c 2022-09-21 20:41:45.883648777 +0200
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
} }

View file

@ -1,5 +1,5 @@
--- ../Rack/src/common.cpp 2023-06-11 21:02:02.640002965 +0200 --- ../Rack/src/common.cpp 2023-05-20 17:03:33.006081772 +0200
+++ common.cpp 2023-06-11 20:56:09.476002797 +0200 +++ common.cpp 2023-05-20 19:44:40.371645493 +0200
@@ -1,12 +1,57 @@ @@ -1,12 +1,57 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin

View file

@ -1,5 +1,5 @@
--- ../Rack/src/context.cpp 2023-06-11 21:02:02.640002965 +0200 --- ../Rack/src/context.cpp 2023-05-20 17:03:33.006081772 +0200
+++ context.cpp 2023-06-11 20:56:09.476002797 +0200 +++ context.cpp 2023-05-20 18:08:56.497736615 +0200
@@ -1,14 +1,44 @@ @@ -1,14 +1,44 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin

View file

@ -1,5 +1,5 @@
--- ../Rack/src/dsp/minblep.cpp 2023-06-11 21:02:02.644002965 +0200 --- ../Rack/src/dsp/minblep.cpp 2022-09-21 20:49:12.200540736 +0200
+++ minblep.cpp 2023-06-11 20:56:09.476002797 +0200 +++ minblep.cpp 2023-05-20 18:21:44.019059009 +0200
@@ -1,3 +1,30 @@ @@ -1,3 +1,30 @@
+/* +/*
+ * DISTRHO Cardinal Plugin + * DISTRHO Cardinal Plugin

View file

@ -1,5 +1,5 @@
--- ../Rack/src/plugin.cpp 2023-06-11 21:02:02.644002965 +0200 --- ../Rack/src/plugin.cpp 2023-05-20 17:03:33.006081772 +0200
+++ plugin.cpp 2023-06-11 20:56:09.476002797 +0200 +++ plugin.cpp 2023-05-20 18:43:27.496323540 +0200
@@ -1,356 +1,46 @@ @@ -1,356 +1,46 @@
-#include <thread> -#include <thread>
-#include <map> -#include <map>