Signed-off-by: falkTX <falktx@falktx.com>tags/22.02
| @@ -37,12 +37,17 @@ | |||||
| #include <string.hpp> | #include <string.hpp> | ||||
| #include <system.hpp> | #include <system.hpp> | ||||
| #include <app/Scene.hpp> | #include <app/Scene.hpp> | ||||
| #include <engine/Engine.hpp> | |||||
| #include <window/Window.hpp> | #include <window/Window.hpp> | ||||
| #ifdef NDEBUG | #ifdef NDEBUG | ||||
| # undef DEBUG | # undef DEBUG | ||||
| #endif | #endif | ||||
| #ifdef HAVE_LIBLO | |||||
| # include <lo/lo.h> | |||||
| #endif | |||||
| // for finding home dir | // for finding home dir | ||||
| #ifndef ARCH_WIN | #ifndef ARCH_WIN | ||||
| # include <pwd.h> | # include <pwd.h> | ||||
| @@ -204,6 +209,27 @@ void saveAsDialog() | |||||
| #endif | #endif | ||||
| } | } | ||||
| void deployToMOD() | |||||
| { | |||||
| #ifdef HAVE_LIBLO | |||||
| const lo_address addr = lo_address_new_with_proto(LO_UDP, REMOTE_HOST, REMOTE_HOST_PORT); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(addr != nullptr,); | |||||
| APP->engine->prepareSave(); | |||||
| APP->patch->saveAutosave(); | |||||
| APP->patch->cleanAutosave(); | |||||
| std::vector<uint8_t> data(rack::system::archiveDirectory(APP->patch->autosavePath, 1)); | |||||
| if (const lo_blob blob = lo_blob_new(data.size(), data.data())) | |||||
| { | |||||
| lo_send(addr, "/load", "b", blob); | |||||
| lo_blob_free(blob); | |||||
| } | |||||
| lo_address_free(addr); | |||||
| #endif | |||||
| } | |||||
| } | } | ||||
| void async_dialog_filebrowser(const bool saving, | void async_dialog_filebrowser(const bool saving, | ||||
| @@ -19,6 +19,12 @@ | |||||
| #pragma once | #pragma once | ||||
| #ifdef HAVE_LIBLO | |||||
| // # define REMOTE_HOST "localhost" | |||||
| # define REMOTE_HOST "192.168.51.1" | |||||
| # define REMOTE_HOST_PORT "2228" | |||||
| #endif | |||||
| namespace rack | namespace rack | ||||
| { | { | ||||
| namespace ui { | namespace ui { | ||||
| @@ -37,5 +43,6 @@ void revertDialog(); | |||||
| void saveDialog(const std::string& path); | void saveDialog(const std::string& path); | ||||
| void saveAsDialog(); | void saveAsDialog(); | ||||
| void appendSelectionContextMenu(rack::ui::Menu* menu); | void appendSelectionContextMenu(rack::ui::Menu* menu); | ||||
| void deployToMOD(); | |||||
| } | } | ||||
| @@ -56,6 +56,10 @@ ifeq ($(DEBUG),true) | |||||
| BASE_FLAGS += -UDEBUG | BASE_FLAGS += -UDEBUG | ||||
| endif | endif | ||||
| ifeq ($(HAVE_LIBLO),true) | |||||
| BASE_FLAGS += -DHAVE_LIBLO | |||||
| endif | |||||
| ifeq ($(HEADLESS),true) | ifeq ($(HEADLESS),true) | ||||
| BASE_FLAGS += -DHEADLESS | BASE_FLAGS += -DHEADLESS | ||||
| endif | endif | ||||
| @@ -56,10 +56,6 @@ | |||||
| #include "../CardinalCommon.hpp" | #include "../CardinalCommon.hpp" | ||||
| // #define REMOTE_HOST "localhost" | |||||
| #define REMOTE_HOST "192.168.51.1" | |||||
| #define REMOTE_HOST_PORT "2228" | |||||
| namespace rack { | namespace rack { | ||||
| namespace app { | namespace app { | ||||
| namespace menuBar { | namespace menuBar { | ||||
| @@ -150,22 +146,8 @@ struct FileButton : MenuButton { | |||||
| lo_address_free(addr); | lo_address_free(addr); | ||||
| })); | })); | ||||
| } else { | } else { | ||||
| menu->addChild(createMenuItem("Deploy to MOD", "", []() { | |||||
| const lo_address addr = lo_address_new_with_proto(LO_UDP, REMOTE_HOST, REMOTE_HOST_PORT); | |||||
| DISTRHO_SAFE_ASSERT_RETURN(addr != nullptr,); | |||||
| APP->engine->prepareSave(); | |||||
| APP->patch->saveAutosave(); | |||||
| APP->patch->cleanAutosave(); | |||||
| std::vector<uint8_t> data(rack::system::archiveDirectory(APP->patch->autosavePath, 1)); | |||||
| if (const lo_blob blob = lo_blob_new(data.size(), data.data())) | |||||
| { | |||||
| lo_send(addr, "/load", "b", blob); | |||||
| lo_blob_free(blob); | |||||
| } | |||||
| lo_address_free(addr); | |||||
| menu->addChild(createMenuItem("Deploy to MOD", "F7", []() { | |||||
| patchUtils::deployToMOD(); | |||||
| })); | })); | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -255,6 +255,10 @@ void Scene::onHoverKey(const HoverKeyEvent& e) { | |||||
| settings::cpuMeter ^= true; | settings::cpuMeter ^= true; | ||||
| e.consume(this); | e.consume(this); | ||||
| } | } | ||||
| if (e.key == GLFW_KEY_F7 && (e.mods & RACK_MOD_MASK) == 0) { | |||||
| patchUtils::deployToMOD(); | |||||
| e.consume(this); | |||||
| } | |||||
| // Module selections | // Module selections | ||||
| if (e.keyName == "a" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) { | if (e.keyName == "a" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) { | ||||