diff --git a/source/Makefile.deps b/source/Makefile.deps index 962835763..64182dd5a 100644 --- a/source/Makefile.deps +++ b/source/Makefile.deps @@ -93,14 +93,14 @@ CARLA_ENGINE_THREAD_HPP = $(CWD)/backend/engine/CarlaEngineThread.hpp $ CARLA_ENGINE_INTERNAL_HPP = $(CWD)/backend/engine/CarlaEngineInternal.hpp $(CARLA_ENGINE_OSC_HPP) $(CARLA_ENGINE_THREAD_HPP) $(CARLA_ENGINE_UTILS_HPP) CARLA_ENGINE_CPP_DEPS = $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BINARY_UTILS_HPP) $(CARLA_ENGINE_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_STATE_UTILS_HPP) $(CARLA_MIDI_H) $(JACK_BRIDGE_HPP) -CARLA_ENGINE_BRIDGE_CPP_DEPS = $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BRIDGE_UTILS_HPP) $(CARLA_MIDI_H) $(JACK_BRIDGE_HPP) +CARLA_ENGINE_BRIDGE_CPP_DEPS = $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BASE64_UTILS_HPP) $(CARLA_BRIDGE_UTILS_HPP) $(CARLA_MIDI_H) $(JACK_BRIDGE_HPP) CARLA_ENGINE_CLIENT_CPP_DEPS = $(CARLA_ENGINE_UTILS_HPP) CARLA_ENGINE_DATA_CPP_DEPS = $(CARLA_ENGINE_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_MIDI_H) CARLA_ENGINE_GRAPH_CPP_DEPS = $(CARLA_ENGINE_GRAPH_HPP) $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_MIDI_H) CARLA_ENGINE_INTERNAL_CPP_DEPS = $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_PLUGIN_HPP) CARLA_ENGINE_JACK_CPP_DEPS = $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_ENGINE_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_MIDI_H) $(CARLA_PATCHBAY_UTILS_HPP) $(JACK_BRIDGE_HPP) CARLA_ENGINE_JUCE_CPP_DEPS = $(CARLA_ENGINE_GRAPH_HPP) $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_STRING_LIST_HPP) $(RT_LINKED_LIST_HPP) -CARLA_ENGINE_NATIVE_CPP_DEPS = $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BASE64_UTILS_HPP) $(CARLA_BINARY_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_STATE_UTILS_HPP) $(CARLA_EXTERNAL_UI_HPP) $(CARLA_NATIVE_HPP) $(CARLA_PLUGIN_UI_CPP) $(CARLA_DSSI_UTILS_CPP) $(CARLA_STATE_UTILS_CPP) +CARLA_ENGINE_NATIVE_CPP_DEPS = $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BASE64_UTILS_HPP) $(CARLA_BINARY_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_STATE_UTILS_HPP) $(CARLA_EXTERNAL_UI_HPP) $(CARLA_NATIVE_HPP) $(CARLA_PLUGIN_UI_CPP) $(CARLA_DSSI_UTILS_CPP) $(CARLA_STATE_UTILS_CPP) CARLA_ENGINE_OSC_CPP_DEPS = $(CARLA_ENGINE_HPP) $(CARLA_ENGINE_OSC_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BRIDGE_UTILS_HPP) $(CARLA_MIDI_H) CARLA_ENGINE_OSC_SEND_CPP_DEPS = $(CARLA_BACKEND_UTILS_HPP) $(CARLA_ENGINE_INTERNAL_HPP) $(CARLA_MIDI_H) CARLA_ENGINE_PORTS_CPP_DEPS = $(CARLA_ENGINE_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_MIDI_H) @@ -129,7 +129,7 @@ CARLA_PLUGIN_THREAD_HPP = $(CWD)/backend/plugin/CarlaPluginThread.hpp $ CARLA_PLUGIN_INTERNAL_HPP = $(CWD)/backend/plugin/CarlaPluginInternal.hpp $(CARLA_PLUGIN_HPP) $(CARLA_PLUGIN_THREAD_HPP) $(CARLA_OSC_UTILS_HPP) $(CARLA_STATE_UTILS_HPP) $(CARLA_MUTEX_HPP) $(RT_LINKED_LIST_HPP) $(CARLA_MIDI_H) AU_PLUGIN_CPP_DEPS = $(CARLA_PLUGIN_HPP) $(CARLA_ENGINE_HPP) $(CARLA_UTILS_HPP) -BRIDGE_PLUGIN_CPP_DEPS = $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BRIDGE_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_SHM_UTILS_HPP) $(JACK_BRIDGE_HPP) +BRIDGE_PLUGIN_CPP_DEPS = $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BASE64_UTILS_HPP) $(CARLA_BRIDGE_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_SHM_UTILS_HPP) $(JACK_BRIDGE_HPP) CARLA_PLUGIN_CPP_DEPS = $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BASE64_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_PLUGIN_UI_HPP) CARLA_PLUGIN_INTERNAL_CPP_DEPS = $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_LIB_COUNTER_HPP) $(CARLA_MATH_UTILS_HPP) CARLA_PLUGIN_THREAD_CPP_DEPS = $(CARLA_PLUGIN_HPP) $(CARLA_PLUGIN_THREAD_HPP) $(CARLA_ENGINE_HPP) diff --git a/source/backend/engine/CarlaEngineBridge.cpp b/source/backend/engine/CarlaEngineBridge.cpp index 9636978dc..79bbe7c15 100644 --- a/source/backend/engine/CarlaEngineBridge.cpp +++ b/source/backend/engine/CarlaEngineBridge.cpp @@ -23,6 +23,7 @@ #include "CarlaPlugin.hpp" #include "CarlaBackendUtils.hpp" +#include "CarlaBase64Utils.hpp" #include "CarlaBridgeUtils.hpp" #include "CarlaMIDI.h" @@ -500,22 +501,22 @@ public: if (plugin == nullptr || ! plugin->isEnabled()) break; String chunkFilePath(chunkFilePathTry); + #ifdef CARLA_OS_WIN + // check if running under Wine if (chunkFilePath.startsWith("/")) - { - // running under Wine, posix host chunkFilePath = chunkFilePath.replaceSection(0, 1, "Z:\\").replace("/", "\\"); - } #endif + File chunkFile(chunkFilePath); CARLA_SAFE_ASSERT_BREAK(chunkFile.existsAsFile()); - MemoryBlock memBlock; - chunkFile.loadFileAsData(memBlock); + String chunkDataBase64(chunkFile.loadFileAsString()); chunkFile.deleteFile(); + CARLA_SAFE_ASSERT_BREAK(chunkDataBase64.isNotEmpty()); - CARLA_SAFE_ASSERT_BREAK(memBlock.getSize() > 0); - plugin->setChunkData(memBlock.getData(), memBlock.getSize()); + std::vector chunk(carla_getChunkFromBase64String(chunkDataBase64.toRawUTF8())); + plugin->setChunkData(chunk.data(), chunk.size()); break; } @@ -555,13 +556,16 @@ public: { CARLA_SAFE_ASSERT_BREAK(data != nullptr); + CarlaString dataBase64 = CarlaString::asBase64(data, dataSize); + CARLA_SAFE_ASSERT_RETURN(dataBase64.length() > 0,); + String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName()); filePath += OS_SEP_STR; filePath += ".CarlaChunk_"; - filePath += fShmAudioPool.filename.buffer() + 18; + filePath += fShmNonRtControl.filename.buffer() + 24; - if (File(filePath).replaceWithData(data, dataSize)) + if (File(filePath).replaceWithText(dataBase64.buffer())) oscSend_bridge_set_chunk_data_file(filePath.toRawUTF8()); } } diff --git a/source/backend/plugin/BridgePlugin.cpp b/source/backend/plugin/BridgePlugin.cpp index 7eacc11bc..10629412d 100644 --- a/source/backend/plugin/BridgePlugin.cpp +++ b/source/backend/plugin/BridgePlugin.cpp @@ -21,6 +21,7 @@ #ifndef BUILD_BRIDGE #include "CarlaBackendUtils.hpp" +#include "CarlaBase64Utils.hpp" #include "CarlaBridgeUtils.hpp" #include "CarlaMathUtils.hpp" #include "CarlaShmUtils.hpp" @@ -57,7 +58,6 @@ // ------------------------------------------------------------------------------------------------------------------- using juce::File; -using juce::MemoryBlock; using juce::String; using juce::StringArray; @@ -379,6 +379,8 @@ public: fShmNonRtControl.clear(); clearBuffers(); + + fInfo.chunk.clear(); } // ------------------------------------------------------------------- @@ -424,10 +426,10 @@ public: { CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS, 0); CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0); - CARLA_SAFE_ASSERT_RETURN(fInfo.chunk.getSize() > 0, 0); + CARLA_SAFE_ASSERT_RETURN(fInfo.chunk.size() > 0, 0); - *dataPtr = fInfo.chunk.getData(); - return fInfo.chunk.getSize(); + *dataPtr = fInfo.chunk.data(); + return fInfo.chunk.size(); } // ------------------------------------------------------------------- @@ -659,13 +661,16 @@ public: CARLA_SAFE_ASSERT_RETURN(data != nullptr,); CARLA_SAFE_ASSERT_RETURN(dataSize > 0,); + CarlaString dataBase64 = CarlaString::asBase64(data, dataSize); + CARLA_SAFE_ASSERT_RETURN(dataBase64.length() > 0,); + String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName()); filePath += OS_SEP_STR; filePath += ".CarlaChunk_"; filePath += fShmAudioPool.filename.buffer() + 18; - if (File(filePath).replaceWithData(data, dataSize)) + if (File(filePath).replaceWithText(dataBase64.buffer())) { const uint32_t ulength(static_cast(filePath.length())); @@ -1753,9 +1758,9 @@ public: if (chunkFile.existsAsFile()) { - fInfo.chunk.reset(); - chunkFile.loadFileAsData(fInfo.chunk); + fInfo.chunk = carla_getChunkFromBase64String(chunkFile.loadFileAsString().toRawUTF8()); chunkFile.deleteFile(); + carla_stderr("chunk data final"); } break; } @@ -2030,7 +2035,7 @@ private: CarlaString label; CarlaString maker; CarlaString copyright; - MemoryBlock chunk; + std::vector chunk; Info() : aIns(0), diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 172cfbc53..0da686c5a 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -509,7 +509,7 @@ const StateSave& CarlaPlugin::getStateSave() if (data != nullptr && dataSize > 0) { - pData->stateSave.chunk = CarlaString::asBase64(data, static_cast(dataSize)).dup(); + pData->stateSave.chunk = CarlaString::asBase64(data, dataSize).dup(); // Don't save anything else if using chunks return pData->stateSave; diff --git a/source/utils/CarlaPluginUI.cpp b/source/utils/CarlaPluginUI.cpp index 48aad185c..9f3e7a627 100644 --- a/source/utils/CarlaPluginUI.cpp +++ b/source/utils/CarlaPluginUI.cpp @@ -305,10 +305,10 @@ bool CarlaPluginUI::tryTransientWinIdMatch(const uintptr_t pid, const char* cons #if defined(CARLA_OS_MAC) return true; - (void)pid; + (void)pid; (void)centerUI; #elif defined(CARLA_OS_WIN) return true; - (void)pid; + (void)pid; (void)centerUI; #elif defined(HAVE_X11) struct ScopedDisplay { Display* display;