Use F7 key as "deploy to MOD" action, make it visible on file menu
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
a16c43f094
commit
28e0295a4a
5 changed files with 43 additions and 20 deletions
|
@ -37,12 +37,17 @@
|
|||
#include <string.hpp>
|
||||
#include <system.hpp>
|
||||
#include <app/Scene.hpp>
|
||||
#include <engine/Engine.hpp>
|
||||
#include <window/Window.hpp>
|
||||
|
||||
#ifdef NDEBUG
|
||||
# undef DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBLO
|
||||
# include <lo/lo.h>
|
||||
#endif
|
||||
|
||||
// for finding home dir
|
||||
#ifndef ARCH_WIN
|
||||
# include <pwd.h>
|
||||
|
@ -204,6 +209,27 @@ void saveAsDialog()
|
|||
#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,
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
|
||||
#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 ui {
|
||||
|
@ -37,5 +43,6 @@ void revertDialog();
|
|||
void saveDialog(const std::string& path);
|
||||
void saveAsDialog();
|
||||
void appendSelectionContextMenu(rack::ui::Menu* menu);
|
||||
void deployToMOD();
|
||||
|
||||
}
|
||||
|
|
|
@ -56,6 +56,10 @@ ifeq ($(DEBUG),true)
|
|||
BASE_FLAGS += -UDEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBLO),true)
|
||||
BASE_FLAGS += -DHAVE_LIBLO
|
||||
endif
|
||||
|
||||
ifeq ($(HEADLESS),true)
|
||||
BASE_FLAGS += -DHEADLESS
|
||||
endif
|
||||
|
|
|
@ -56,10 +56,6 @@
|
|||
|
||||
#include "../CardinalCommon.hpp"
|
||||
|
||||
// #define REMOTE_HOST "localhost"
|
||||
#define REMOTE_HOST "192.168.51.1"
|
||||
#define REMOTE_HOST_PORT "2228"
|
||||
|
||||
namespace rack {
|
||||
namespace app {
|
||||
namespace menuBar {
|
||||
|
@ -150,22 +146,8 @@ struct FileButton : MenuButton {
|
|||
lo_address_free(addr);
|
||||
}));
|
||||
} 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
|
||||
|
|
|
@ -255,6 +255,10 @@ void Scene::onHoverKey(const HoverKeyEvent& e) {
|
|||
settings::cpuMeter ^= true;
|
||||
e.consume(this);
|
||||
}
|
||||
if (e.key == GLFW_KEY_F7 && (e.mods & RACK_MOD_MASK) == 0) {
|
||||
patchUtils::deployToMOD();
|
||||
e.consume(this);
|
||||
}
|
||||
|
||||
// Module selections
|
||||
if (e.keyName == "a" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue