Better OSC defaults, dont reset context for desktop builds

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2024-09-21 20:35:04 +02:00
parent 1c659cbd67
commit 47d4e08f49
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
6 changed files with 80 additions and 76 deletions

View file

@ -1,18 +1,7 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/**
@ -295,7 +284,7 @@ static void Engine_stepFrame(Engine* that) {
Param* smoothParam = &smoothModule->params[smoothParamId];
float value = smoothParam->value;
float newValue;
if (internal->remoteDetails != nullptr) {
if (internal->remoteDetails != nullptr && internal->remoteDetails->connected) {
newValue = value;
sendParamChangeToRemote(internal->remoteDetails, smoothModule->id, smoothParamId, value);
} else {
@ -1094,7 +1083,7 @@ void Engine::setParamValue(Module* module, int paramId, float value) {
internal->smoothModule = NULL;
internal->smoothParamId = 0;
}
if (internal->remoteDetails != nullptr) {
if (internal->remoteDetails != nullptr && internal->remoteDetails->connected) {
sendParamChangeToRemote(internal->remoteDetails, module->id, paramId, value);
}
module->params[paramId].setValue(value);

View file

@ -1,18 +1,7 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/**
@ -207,14 +196,19 @@ void Scene::step() {
if (remoteUtils::RemoteDetails* const remoteDetails = remoteUtils::getRemote()) {
idleRemote(remoteDetails);
if (remoteDetails->autoDeploy) {
if (remoteDetails->autoDeploy && remoteDetails->connected) {
const int actionIndex = APP->history->actionIndex;
const double time = system::getTime();
if (internal->historyActionIndex == -1) {
internal->historyActionIndex = actionIndex;
internal->lastSceneChangeTime = time;
} else if (internal->historyActionIndex != actionIndex && actionIndex > 0 && time - internal->lastSceneChangeTime >= 1.0) {
} else if (remoteDetails->first ||
(internal->historyActionIndex != actionIndex
&& actionIndex > 0
&& time - internal->lastSceneChangeTime >= 1.0)) {
remoteDetails->first = false;
const std::string& name(APP->history->actions[actionIndex - 1]->name);
static const std::vector<std::string> ignoredNames = {
"move knob",
@ -224,7 +218,10 @@ void Scene::step() {
if (std::find(ignoredNames.cbegin(), ignoredNames.cend(), name) == ignoredNames.cend()) {
printf("action '%s'\n", APP->history->actions[actionIndex - 1]->name.c_str());
remoteUtils::sendFullPatchToRemote(remoteDetails);
window::generateScreenshot();
if (remoteDetails->screenshot) {
window::generateScreenshot();
}
}
internal->historyActionIndex = actionIndex;
internal->lastSceneChangeTime = time;
@ -334,8 +331,13 @@ void Scene::onHoverKey(const HoverKeyEvent& e) {
if (e.key == GLFW_KEY_F7 && (e.mods & RACK_MOD_MASK) == 0) {
if (remoteUtils::RemoteDetails* const remoteDetails = remoteUtils::getRemote())
{
remoteUtils::sendFullPatchToRemote(remoteDetails);
window::generateScreenshot();
if (remoteDetails->connected) {
remoteUtils::sendFullPatchToRemote(remoteDetails);
if (remoteDetails->screenshot) {
window::generateScreenshot();
}
}
}
e.consume(this);
}

View file

@ -1,18 +1,7 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/**
@ -598,7 +587,7 @@ static void Window__writeImagePNG(void* context, void* data, int size) {
CardinalBaseUI* const ui = static_cast<CardinalBaseUI*>(context);
if (char* const screenshot = String::asBase64(data, size).getAndReleaseBuffer()) {
ui->setState("screenshot", screenshot);
if (ui->remoteDetails != nullptr)
if (ui->remoteDetails != nullptr && ui->remoteDetails->connected && ui->remoteDetails->screenshot)
remoteUtils::sendScreenshotToRemote(ui->remoteDetails, screenshot);
std::free(screenshot);
}