diff --git a/source/backend/engine/CarlaEngineBridge.cpp b/source/backend/engine/CarlaEngineBridge.cpp index 19aca0b67..947259536 100644 --- a/source/backend/engine/CarlaEngineBridge.cpp +++ b/source/backend/engine/CarlaEngineBridge.cpp @@ -463,6 +463,50 @@ public: break; } + case kPluginBridgeOpcodePrepareForSave: { + carla_prepare_for_save(0); + + for (uint32_t i=0, count=carla_get_custom_data_count(0); itype, cdata->key, cdata->value); + } + + //if (fPlugin->getOptionsEnabled() & CarlaBackend::PLUGIN_OPTION_USE_CHUNKS) + { + //if (const char* const chunkData = carla_get_chunk_data(0)) + { +#if 0 + QString filePath; + filePath = QDir::tempPath(); + #ifdef Q_OS_WIN + filePath += "\\.CarlaChunk_"; + #else + filePath += "/.CarlaChunk_"; + #endif + filePath += fPlugin->getName(); + + QFile file(filePath); + + if (file.open(QIODevice::WriteOnly)) + { + QByteArray chunk((const char*)data, dataSize); + file.write(chunk); + file.close(); + fEngine->oscSend_bridge_set_chunk_data(filePath.toUtf8().constData()); + } +#endif + } + } + + carla_stdout("-----------------------------------------------------, got prepare for save"); + + oscSend_bridge_configure(CARLA_BRIDGE_MSG_SAVED, ""); + break; + } + case kPluginBridgeOpcodeMidiEvent: { const int64_t time(fShmControl.readLong()); const int32_t size(fShmControl.readInt()); @@ -543,10 +587,26 @@ public: break; } + case kPluginBridgeOpcodeShowUI: + carla_stdout("-----------------------------------------------------, got SHOW UI"); + + carla_show_custom_ui(0, true); + break; + + case kPluginBridgeOpcodeHideUI: + carla_stdout("-----------------------------------------------------, got HIDE UI"); + + carla_show_custom_ui(0, false); + break; + case kPluginBridgeOpcodeQuit: signalThreadShouldExit(); fIsRunning = false; break; + + default: + carla_stderr2("Unhandled Plugin opcode %i", opcode); + break; } } diff --git a/source/backend/engine/CarlaEngineOsc.cpp b/source/backend/engine/CarlaEngineOsc.cpp index c3c92ad5f..d8e4e4f1f 100644 --- a/source/backend/engine/CarlaEngineOsc.cpp +++ b/source/backend/engine/CarlaEngineOsc.cpp @@ -279,12 +279,17 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons return 0; } - // Common OSC methods (DSSI and bridge UIs) + // Common OSC methods (all bridges) if (std::strcmp(method, "update") == 0) { const lo_address source(lo_message_get_source(msg)); return handleMsgUpdate(plugin, argc, argv, types, source); } + if (std::strcmp(method, "exiting") == 0) + return handleMsgExiting(plugin); + +#ifndef BUILD_BRIDGE + // Common OSC methods (DSSI and bridge UIs) if (std::strcmp(method, "configure") == 0) return handleMsgConfigure(plugin, argc, argv, types); if (std::strcmp(method, "control") == 0) @@ -293,10 +298,7 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons return handleMsgProgram(plugin, argc, argv, types); if (std::strcmp(method, "midi") == 0) return handleMsgMidi(plugin, argc, argv, types); - if (std::strcmp(method, "exiting") == 0) - return handleMsgExiting(plugin); -#ifndef BUILD_BRIDGE // Internal methods if (std::strcmp(method, "set_active") == 0) return handleMsgSetActive(plugin, argc, argv, types); @@ -379,13 +381,13 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons if (std::strcmp(bmethod, "error") == 0) return CarlaPluginSetOscBridgeInfo(plugin, kPluginBridgeError, argc, argv, types); } -#endif // Plugin-specific methods if (std::strcmp(method, "lv2_atom_transfer") == 0) return handleMsgLv2AtomTransfer(plugin, argc, argv, types); if (std::strcmp(method, "lv2_urid_map") == 0) return handleMsgLv2UridMap(plugin, argc, argv, types); +#endif carla_stderr("CarlaEngineOsc::handleMessage() - unsupported OSC method '%s'", method); return 1; @@ -393,6 +395,30 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons // ----------------------------------------------------------------------- +int CarlaEngineOsc::handleMsgUpdate(CARLA_ENGINE_OSC_HANDLE_ARGS2, const lo_address source) +{ + carla_debug("CarlaEngineOsc::handleMsgUpdate()"); + CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "s"); + + const char* const url = (const char*)&argv[0]->s; + + plugin->updateOscData(source, url); + return 0; +} + +int CarlaEngineOsc::handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1) +{ + carla_debug("CarlaEngineOsc::handleMsgExiting()"); + + // TODO - check for non-UIs (dssi-vst) and set to -1 instead + fEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, plugin->getId(), 0, 0, 0.0f, nullptr); + + plugin->showCustomUI(false); + return 0; +} + +// ----------------------------------------------------------------------- + #ifndef BUILD_BRIDGE int CarlaEngineOsc::handleMsgRegister(const bool isTCP, const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source) { @@ -449,21 +475,9 @@ int CarlaEngineOsc::handleMsgUnregister() fControlData.clear(); return 0; } -#endif // ----------------------------------------------------------------------- -int CarlaEngineOsc::handleMsgUpdate(CARLA_ENGINE_OSC_HANDLE_ARGS2, const lo_address source) -{ - carla_debug("CarlaEngineOsc::handleMsgUpdate()"); - CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "s"); - - const char* const url = (const char*)&argv[0]->s; - - plugin->updateOscData(source, url); - return 0; -} - int CarlaEngineOsc::handleMsgConfigure(CARLA_ENGINE_OSC_HANDLE_ARGS2) { carla_debug("CarlaEngineOsc::handleMsgConfigure()"); @@ -569,20 +583,8 @@ int CarlaEngineOsc::handleMsgMidi(CARLA_ENGINE_OSC_HANDLE_ARGS2) #endif } -int CarlaEngineOsc::handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1) -{ - carla_debug("CarlaEngineOsc::handleMsgExiting()"); - - // TODO - check for non-UIs (dssi-vst) and set to -1 instead - fEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, plugin->getId(), 0, 0, 0.0f, nullptr); - - plugin->showCustomUI(false); - return 0; -} - // ----------------------------------------------------------------------- -#ifndef BUILD_BRIDGE int CarlaEngineOsc::handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS2) { carla_debug("CarlaEngineOsc::handleMsgSetActive()"); @@ -750,7 +752,7 @@ int CarlaEngineOsc::handleMsgNoteOff(CARLA_ENGINE_OSC_HANDLE_ARGS2) plugin->sendMidiSingleNote(static_cast(channel), static_cast(note), 0, true, false, true); return 0; } -#endif +#endif // ! BUILD_BRIDGE // ----------------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngineOsc.hpp b/source/backend/engine/CarlaEngineOsc.hpp index fe80e9c43..15869fd18 100644 --- a/source/backend/engine/CarlaEngineOsc.hpp +++ b/source/backend/engine/CarlaEngineOsc.hpp @@ -108,19 +108,18 @@ private: int handleMessage(const bool isTCP, const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg); + int handleMsgUpdate(CARLA_ENGINE_OSC_HANDLE_ARGS2, const lo_address source); + int handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1); + #ifndef BUILD_BRIDGE int handleMsgRegister(const bool isTCP, const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source); int handleMsgUnregister(); -#endif - int handleMsgUpdate(CARLA_ENGINE_OSC_HANDLE_ARGS2, const lo_address source); int handleMsgConfigure(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgControl(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgProgram(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgMidi(CARLA_ENGINE_OSC_HANDLE_ARGS2); - int handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1); -#ifndef BUILD_BRIDGE int handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgSetDryWet(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgSetVolume(CARLA_ENGINE_OSC_HANDLE_ARGS2); @@ -134,10 +133,10 @@ private: int handleMsgSetMidiProgram(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgNoteOn(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgNoteOff(CARLA_ENGINE_OSC_HANDLE_ARGS2); -#endif int handleMsgLv2AtomTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgLv2UridMap(CARLA_ENGINE_OSC_HANDLE_ARGS2); +#endif // ----------------------------------------------------------------------- diff --git a/source/backend/plugin/BridgePlugin.cpp b/source/backend/plugin/BridgePlugin.cpp index a229a0fca..ac62bc7eb 100644 --- a/source/backend/plugin/BridgePlugin.cpp +++ b/source/backend/plugin/BridgePlugin.cpp @@ -347,12 +347,6 @@ public: fShmControl.waitForServer(3); } - if (pData->osc.data.target != nullptr) - { - osc_send_hide(pData->osc.data); - osc_send_quit(pData->osc.data); - } - pData->osc.data.clear(); pData->osc.thread.stopThread(3000); @@ -490,22 +484,30 @@ public: void prepareForSave() override { -#if 0 - m_saved = false; - osc_send_configure(&osc.data, CARLA_BRIDGE_MSG_SAVE_NOW, ""); + fSaved = false; + + { + const CarlaMutexLocker _cml(fShmControl.lock); + + fShmControl.writeOpcode(kPluginBridgeOpcodePrepareForSave); + fShmControl.commitWrite(); + } + + carla_stdout("BridgePlugin::prepareForSave() - sent, now waiting..."); for (int i=0; i < 200; ++i) { - if (m_saved) + if (fSaved) break; - carla_msleep(50); + carla_msleep(30); + pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); + pData->engine->idle(); } - if (! m_saved) + if (! fSaved) carla_stderr("BridgePlugin::prepareForSave() - Timeout while requesting save state"); else - carla_debug("BridgePlugin::prepareForSave() - success!"); -#endif + carla_stdout("BridgePlugin::prepareForSave() - success!"); } // ------------------------------------------------------------------- @@ -618,17 +620,20 @@ public: void showCustomUI(const bool yesNo) override { - if (yesNo) { - osc_send_show(pData->osc.data); + const CarlaMutexLocker _cml(fShmControl.lock); + fShmControl.writeOpcode(yesNo ? kPluginBridgeOpcodeShowUI : kPluginBridgeOpcodeHideUI); + fShmControl.commitWrite(); + } + + if (yesNo) + { pData->tryTransient(); } else { pData->transientTryCounter = 0; - - osc_send_hide(pData->osc.data); } } diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 4751af177..5161f2c4b 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -490,7 +490,6 @@ const StateSave& CarlaPlugin::getStateSave() pData->stateSave.label = carla_strdup(strBuf); pData->stateSave.uniqueId = getUniqueId(); pData->stateSave.options = pData->options; - carla_stdout("Options: 0x%x | 0x%x", pData->options, pData->stateSave.options); if (pData->filename != nullptr) pData->stateSave.binary = carla_strdup(pData->filename); diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index ebac32098..10168f1e5 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -5780,6 +5780,7 @@ private: #define lv2PluginPtr ((Lv2Plugin*)plugin) +#ifndef BUILD_BRIDGE int CarlaEngineOsc::handleMsgLv2AtomTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2) { CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "is"); @@ -5811,6 +5812,7 @@ int CarlaEngineOsc::handleMsgLv2UridMap(CARLA_ENGINE_OSC_HANDLE_ARGS2) lv2PluginPtr->handleUridMap(static_cast(urid), uri); return 0; } +#endif #undef lv2PluginPtr diff --git a/source/bridges/CarlaBridgeClient.cpp b/source/bridges/CarlaBridgeClient.cpp index 54222c7aa..bcd58630a 100644 --- a/source/bridges/CarlaBridgeClient.cpp +++ b/source/bridges/CarlaBridgeClient.cpp @@ -154,6 +154,8 @@ void CarlaBridgeClient::sendOscUpdate() const osc_send_update(fOscData, fOsc.getServerPath()); } +// --------------------------------------------------------------------- + #ifdef BUILD_BRIDGE_PLUGIN void CarlaBridgeClient::sendOscBridgeUpdate() const { @@ -174,6 +176,7 @@ void CarlaBridgeClient::sendOscBridgeError(const char* const error) const // --------------------------------------------------------------------- +#ifdef BUILD_BRIDGE_UI void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* const value) const { carla_debug("CarlaBridgeClient::sendOscConfigure(\"%s\", \"%s\")", key, value); @@ -242,7 +245,6 @@ void CarlaBridgeClient::sendOscLv2UridMap(const uint32_t urid, const char* const // --------------------------------------------------------------------- -#ifdef BUILD_BRIDGE_UI void* CarlaBridgeClient::getContainerId() { carla_debug("CarlaBridgeClient::getContainerId()"); @@ -285,6 +287,8 @@ const char* CarlaBridgeClient::uiLibError() return lib_error(fUI.filename); } -#endif +#endif // BUILD_BRIDGE_UI + +// --------------------------------------------------------------------- CARLA_BRIDGE_END_NAMESPACE diff --git a/source/bridges/CarlaBridgeClient.hpp b/source/bridges/CarlaBridgeClient.hpp index 7919eee44..30dc7f4da 100644 --- a/source/bridges/CarlaBridgeClient.hpp +++ b/source/bridges/CarlaBridgeClient.hpp @@ -86,6 +86,7 @@ public: // --------------------------------------------------------------------- protected: +#ifdef BUILD_BRIDGE_UI void sendOscConfigure(const char* const key, const char* const value) const; void sendOscControl(const int32_t index, const float value) const; void sendOscProgram(const uint32_t index) const; @@ -93,14 +94,13 @@ protected: void sendOscMidi(const uint8_t midiBuf[4]) const; void sendOscExiting() const; -#ifdef BRIDGE_LV2 +# ifdef BRIDGE_LV2 void sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf) const; void sendOscLv2UridMap(const uint32_t urid, const char* const uri) const; -#endif +# endif // --------------------------------------------------------------------- -#ifdef BUILD_BRIDGE_UI void* getContainerId(); bool uiLibOpen(const char* const filename); bool uiLibClose(); @@ -155,7 +155,6 @@ private: } fUI; #else friend class CarlaPluginClient; - friend class JackBridgeClient; #endif CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeClient) diff --git a/source/bridges/CarlaBridgeOsc.cpp b/source/bridges/CarlaBridgeOsc.cpp index 8c34a0656..b93859310 100644 --- a/source/bridges/CarlaBridgeOsc.cpp +++ b/source/bridges/CarlaBridgeOsc.cpp @@ -20,10 +20,6 @@ CARLA_BRIDGE_START_NAMESPACE -#if 0 -} // Fix editor indentation -#endif - // ----------------------------------------------------------------------- CarlaBridgeOsc::CarlaBridgeOsc(CarlaBridgeClient* const client) @@ -160,42 +156,28 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const if (std::strcmp(method, "quit") == 0) return handleMsgQuit(); -#ifdef BRIDGE_LV2 - // LV2 methods - if (std::strcmp(method, "lv2_atom_transfer") == 0) - return handleMsgLv2AtomTransfer(argc, argv, types); - if (std::strcmp(method, "lv2_urid_map") == 0) - return handleMsgLv2UridMap(argc, argv, types); -#endif - #ifdef BUILD_BRIDGE_UI // UI methods if (std::strcmp(method, "configure") == 0) - return handleMsgConfigure(argc, argv, types); + return handleMsgUiConfigure(argc, argv, types); if (std::strcmp(method, "control") == 0) - return handleMsgControl(argc, argv, types); + return handleMsgUiControl(argc, argv, types); if (std::strcmp(method, "program") == 0) - return handleMsgProgram(argc, argv, types); + return handleMsgUiProgram(argc, argv, types); if (std::strcmp(method, "midi-program") == 0) - return handleMsgMidiProgram(argc, argv, types); + return handleMsgUiMidiProgram(argc, argv, types); if (std::strcmp(method, "midi") == 0) - return handleMsgMidi(argc, argv, types); + return handleMsgUiMidi(argc, argv, types); if (std::strcmp(method, "sample-rate") == 0) return 0; // unused -#endif -#if defined(BUILD_BRIDGE_PLUGIN) && ! defined(BRIDGE_JACK) - // Plugin methods - if (std::strcmp(method, "plugin_save_now") == 0) - return handleMsgPluginSaveNow(); - if (std::strcmp(method, "plugin_set_parameter_midi_channel") == 0) - return handleMsgPluginSetParameterMidiChannel(argc, argv, types); - if (std::strcmp(method, "plugin_set_parameter_midi_cc") == 0) - return handleMsgPluginSetParameterMidiCC(argc, argv, types); - if (std::strcmp(method, "plugin_set_chunk") == 0) - return handleMsgPluginSetChunk(argc, argv, types); - if (std::strcmp(method, "plugin_set_custom_data") == 0) - return handleMsgPluginSetCustomData(argc, argv, types); +# ifdef BRIDGE_LV2 + // LV2 methods + if (std::strcmp(method, "lv2_atom_transfer") == 0) + return handleMsgLv2UiAtomTransfer(argc, argv, types); + if (std::strcmp(method, "lv2_urid_map") == 0) + return handleMsgLv2UiUridMap(argc, argv, types); +# endif #endif carla_stderr("CarlaBridgeOsc::handleMessage(\"%s\", ...) - received unsupported OSC method '%s'", path, method); @@ -233,7 +215,7 @@ int CarlaBridgeOsc::handleMsgQuit() return 0; } -int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) +int CarlaBridgeOsc::handleMsgUiConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) { CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); @@ -246,7 +228,7 @@ int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) (void)argv; } -int CarlaBridgeOsc::handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) +int CarlaBridgeOsc::handleMsgUiControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) { CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "if"); CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); @@ -262,7 +244,7 @@ int CarlaBridgeOsc::handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) return 0; } -int CarlaBridgeOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) +int CarlaBridgeOsc::handleMsgUiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) { CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); @@ -277,7 +259,7 @@ int CarlaBridgeOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) return 0; } -int CarlaBridgeOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) +int CarlaBridgeOsc::handleMsgUiMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) { CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); @@ -294,7 +276,7 @@ int CarlaBridgeOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) return 0; } -int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) +int CarlaBridgeOsc::handleMsgUiMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) { CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "m"); CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); @@ -329,6 +311,9 @@ int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) return 0; } + #endif // BUILD_BRIDGE_UI +// ----------------------------------------------------------------------- + CARLA_BRIDGE_END_NAMESPACE diff --git a/source/bridges/CarlaBridgeOsc.hpp b/source/bridges/CarlaBridgeOsc.hpp index 3a98591ce..aa52508a9 100644 --- a/source/bridges/CarlaBridgeOsc.hpp +++ b/source/bridges/CarlaBridgeOsc.hpp @@ -94,29 +94,21 @@ private: int handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg); -#ifdef BUILD_BRIDGE_UI - int handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS); -#endif - int handleMsgShow(); int handleMsgHide(); int handleMsgQuit(); -#ifdef BRIDGE_LV2 - int handleMsgLv2AtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgLv2UridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS); -#endif - -#ifdef BUILD_BRIDGE_PLUGIN - int handleMsgPluginSaveNow(); - int handleMsgPluginSetParameterMidiChannel(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgPluginSetParameterMidiCC(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgPluginSetCustomData(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgPluginSetChunk(CARLA_BRIDGE_OSC_HANDLE_ARGS); +#ifdef BUILD_BRIDGE_UI + int handleMsgUiConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS); + int handleMsgUiControl(CARLA_BRIDGE_OSC_HANDLE_ARGS); + int handleMsgUiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS); + int handleMsgUiMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS); + int handleMsgUiMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS); + +# ifdef BRIDGE_LV2 + int handleMsgLv2UiAtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS); + int handleMsgLv2UiUridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS); +# endif #endif // ------------------------------------------------------------------- diff --git a/source/bridges/CarlaBridgePlugin.cpp b/source/bridges/CarlaBridgePlugin.cpp index e3a7f4e7f..cc664dbfa 100644 --- a/source/bridges/CarlaBridgePlugin.cpp +++ b/source/bridges/CarlaBridgePlugin.cpp @@ -254,54 +254,6 @@ public: } // --------------------------------------------------------------------- - // plugin management - - void prepareForSave() - { - CARLA_SAFE_ASSERT_RETURN(fEngine != nullptr,); - carla_debug("CarlaPluginClient::prepareForSave()"); - - carla_prepare_for_save(0); - - for (uint32_t i=0, count=carla_get_custom_data_count(0); ioscSend_bridge_set_custom_data(cdata->type, cdata->key, cdata->value); - } - - //if (fPlugin->getOptionsEnabled() & CarlaBackend::PLUGIN_OPTION_USE_CHUNKS) - { - //if (const char* const chunkData = carla_get_chunk_data(0)) - { -#if 0 - QString filePath; - filePath = QDir::tempPath(); -#ifdef Q_OS_WIN - filePath += "\\.CarlaChunk_"; -#else - filePath += "/.CarlaChunk_"; -#endif - filePath += fPlugin->getName(); - - QFile file(filePath); - - if (file.open(QIODevice::WriteOnly)) - { - QByteArray chunk((const char*)data, dataSize); - file.write(chunk); - file.close(); - fEngine->oscSend_bridge_set_chunk_data(filePath.toUtf8().constData()); - } -#endif - } - } - - fEngine->oscSend_bridge_configure(CARLA_BRIDGE_MSG_SAVED, ""); - } - - // --------------------------------------------------------------------- protected: void handleCallback(const EngineCallbackOpcode action, const int value1, const int value2, const float value3, const char* const valueStr) @@ -386,17 +338,9 @@ int CarlaBridgeOsc::handleMsgQuit() return 0; } +#if 0 // ------------------------------------------------------------------------- -int CarlaBridgeOsc::handleMsgPluginSaveNow() -{ - CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); - carla_debug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); - - ((CarlaPluginClient*)fClient)->prepareForSave(); - return 0; -} - int CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel(CARLA_BRIDGE_OSC_HANDLE_ARGS) { CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); @@ -474,6 +418,7 @@ int CarlaBridgeOsc::handleMsgPluginSetChunk(CARLA_BRIDGE_OSC_HANDLE_ARGS) carla_set_chunk_data(0, chunkData.toRawUTF8()); return 0; } +#endif CARLA_BRIDGE_END_NAMESPACE diff --git a/source/bridges/CarlaBridgeUI-LV2.cpp b/source/bridges/CarlaBridgeUI-LV2.cpp index 503f961a1..1a6cc1c66 100644 --- a/source/bridges/CarlaBridgeUI-LV2.cpp +++ b/source/bridges/CarlaBridgeUI-LV2.cpp @@ -1156,7 +1156,7 @@ private: #define lv2ClientPtr ((CarlaLv2Client*)fClient) -int CarlaBridgeOsc::handleMsgLv2AtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS) +int CarlaBridgeOsc::handleMsgLv2UiAtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS) { CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "is"); carla_debug("CarlaBridgeOsc::handleMsgLv2AtomTransfer()"); @@ -1178,7 +1178,7 @@ int CarlaBridgeOsc::handleMsgLv2AtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS) return 0; } -int CarlaBridgeOsc::handleMsgLv2UridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS) +int CarlaBridgeOsc::handleMsgLv2UiUridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS) { CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "is"); carla_debug("CarlaBridgeOsc::handleMsgLv2UridMap()"); diff --git a/source/utils/CarlaBridgeUtils.hpp b/source/utils/CarlaBridgeUtils.hpp index 285cbd1ca..0f532a038 100644 --- a/source/utils/CarlaBridgeUtils.hpp +++ b/source/utils/CarlaBridgeUtils.hpp @@ -50,27 +50,28 @@ enum PluginBridgeInfoType { }; enum PluginBridgeOpcode { - kPluginBridgeOpcodeNull = 0, - kPluginBridgeOpcodeSetAudioPool = 1, // long - kPluginBridgeOpcodeSetBufferSize = 2, // int - kPluginBridgeOpcodeSetSampleRate = 3, // float - kPluginBridgeOpcodeSetParameterRt = 4, // int, float - kPluginBridgeOpcodeSetParameterNonRt = 5, // int, float - kPluginBridgeOpcodeSetProgram = 6, // int - kPluginBridgeOpcodeSetMidiProgram = 7, // int - kPluginBridgeOpcodeMidiEvent = 8, // long, int, char[] (long = timeFrame, int = size max 4) - kPluginBridgeOpcodeProcess = 9, - kPluginBridgeOpcodeQuit = 10 + kPluginBridgeOpcodeNull = 0, + kPluginBridgeOpcodeSetAudioPool = 1, // long + kPluginBridgeOpcodeSetBufferSize = 2, // int + kPluginBridgeOpcodeSetSampleRate = 3, // float + kPluginBridgeOpcodeSetParameterRt = 4, // int, float + kPluginBridgeOpcodeSetParameterNonRt = 5, // int, float + kPluginBridgeOpcodeSetParameterMidiChannel = 6, // int, float + kPluginBridgeOpcodeSetParameterMidiCC = 7, // int, float + kPluginBridgeOpcodeSetProgram = 8, // int + kPluginBridgeOpcodeSetMidiProgram = 9, // int + kPluginBridgeOpcodeSetCustomData = 10, // str, str, str + kPluginBridgeOpcodeSetChunkFile = 11, // str + kPluginBridgeOpcodePrepareForSave = 12, + kPluginBridgeOpcodeMidiEvent = 13, // long, int, char[] (long = timeFrame, int = size max 4) + kPluginBridgeOpcodeProcess = 14, + kPluginBridgeOpcodeShowUI = 15, + kPluginBridgeOpcodeHideUI = 16, + kPluginBridgeOpcodeQuit = 17 }; -const char* const CARLA_BRIDGE_MSG_HIDE_GUI = "CarlaBridgeHideGUI"; //!< Plugin -> Host call, tells host GUI is now hidden -const char* const CARLA_BRIDGE_MSG_SAVED = "CarlaBridgeSaved"; //!< Plugin -> Host call, tells host state is saved -#if 0 -const char* const CARLA_BRIDGE_MSG_SAVE_NOW = "CarlaBridgeSaveNow"; //!< Host -> Plugin call, tells plugin to save state now -const char* const CARLA_BRIDGE_MSG_SET_CHUNK = "CarlaBridgeSetChunk"; //!< Host -> Plugin call, tells plugin to set chunk in file \a value -const char* const CARLA_BRIDGE_MSG_SET_CUSTOM = "CarlaBridgeSetCustom"; //!< Host -> Plugin call, tells plugin to set a custom data set using \a value ("type·key·rvalue"). -//If \a type is 'chunk' or 'binary' \a rvalue refers to chunk file. -#endif +const char* const CARLA_BRIDGE_MSG_HIDE_GUI = "CarlaBridgeHideGUI"; //!< Plugin -> Host call, tells host GUI is now hidden +const char* const CARLA_BRIDGE_MSG_SAVED = "CarlaBridgeSaved"; //!< Plugin -> Host call, tells host state is saved // -----------------------------------------------------------------------