| @@ -100,7 +100,7 @@ CARLA_ENGINE_GRAPH_CPP_DEPS = $(CARLA_ENGINE_GRAPH_HPP) $(CARLA_ENGINE_INTERN | |||
| 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_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) | |||
| @@ -130,7 +130,7 @@ CARLA_PLUGIN_INTERNAL_HPP = $(CWD)/backend/plugin/CarlaPluginInternal.hpp $ | |||
| 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) | |||
| CARLA_PLUGIN_CPP_DEPS = $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_MATH_UTILS_HPP) $(CARLA_PLUGIN_UI_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) | |||
| CSOUND_PLUGIN_CPP_DEPS = $(CARLA_PLUGIN_INTERNAL_HPP) $(CARLA_ENGINE_HPP) | |||
| @@ -165,7 +165,7 @@ VST3_PLUGIN_CPP = $(CWD)/backend/plugin/Vst3Plugin.cpp $ | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| # backend/standalone | |||
| CARLA_STANDALONE_CPP_DEPS = $(CARLA_HOST_H) $(CARLA_MIDI_H) $(CARLA_NATIVE_H) $(CARLA_ENGINE_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_OSC_UTILS_HPP) | |||
| CARLA_STANDALONE_CPP_DEPS = $(CARLA_HOST_H) $(CARLA_MIDI_H) $(CARLA_NATIVE_H) $(CARLA_ENGINE_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BASE64_UTILS_HPP) $(CARLA_OSC_UTILS_HPP) | |||
| CARLA_STANDALONE_CPP = $(CWD)/backend/CarlaStandalone.cpp $(CARLA_STANDALONE_CPP_DEPS) $(CARLA_PLUGIN_UI_CPP) $(CARLA_DSSI_UTILS_CPP) $(CARLA_STATE_UTILS_CPP) | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| @@ -564,14 +564,13 @@ public: | |||
| virtual void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui); | |||
| /*! | |||
| * Set the complete chunk data as \a stringData.\n | |||
| * \a stringData must a base64 encoded string of binary data. | |||
| * Set the complete chunk data as \a data.\n | |||
| * | |||
| * \see getChunkData() | |||
| * | |||
| * \note Make sure to verify the plugin supports chunks before calling this function! | |||
| * \note Make sure to verify the plugin supports chunks before calling this function | |||
| */ | |||
| virtual void setChunkData(const char* const stringData); | |||
| virtual void setChunkData(const void* const data, const std::size_t dataSize); | |||
| /*! | |||
| * Change the current plugin program to \a index. | |||
| @@ -26,6 +26,7 @@ | |||
| #include "CarlaPlugin.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaOscUtils.hpp" | |||
| #include "juce_audio_formats.h" | |||
| @@ -2141,7 +2142,10 @@ void carla_set_chunk_data(uint pluginId, const char* chunkData) | |||
| if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | |||
| { | |||
| if (plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS) | |||
| return plugin->setChunkData(chunkData); | |||
| { | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(chunkData)); | |||
| return plugin->setChunkData(chunk.data(), chunk.size()); | |||
| } | |||
| carla_stderr2("carla_set_chunk_data(%i, \"%s\") - plugin does not use chunks", pluginId, chunkData); | |||
| return; | |||
| @@ -32,6 +32,7 @@ | |||
| #include <ctime> | |||
| using juce::File; | |||
| using juce::MemoryBlock; | |||
| using juce::String; | |||
| // ------------------------------------------------------------------- | |||
| @@ -506,15 +507,15 @@ public: | |||
| chunkFilePath = chunkFilePath.replaceSection(0, 1, "Z:\\").replace("/", "\\"); | |||
| } | |||
| #endif | |||
| File chunkFile(chunkFilePath); | |||
| CARLA_SAFE_ASSERT_BREAK(chunkFile.existsAsFile()); | |||
| String chunkData(chunkFile.loadFileAsString()); | |||
| MemoryBlock memBlock; | |||
| chunkFile.loadFileAsData(memBlock); | |||
| chunkFile.deleteFile(); | |||
| CARLA_SAFE_ASSERT_BREAK(chunkData.isNotEmpty()); | |||
| plugin->setChunkData(chunkData.toRawUTF8()); | |||
| CARLA_SAFE_ASSERT_BREAK(memBlock.getSize() > 0); | |||
| plugin->setChunkData(memBlock.getData(), memBlock.getSize()); | |||
| break; | |||
| } | |||
| @@ -549,16 +550,18 @@ public: | |||
| if (plugin->getOptionsEnabled() & PLUGIN_OPTION_USE_CHUNKS) | |||
| { | |||
| if (const char* const chunkData = carla_get_chunk_data(0)) | |||
| //if (const char* const chunkData = plugin->getChunkData()) | |||
| void* data = nullptr; | |||
| if (const std::size_t dataSize = plugin->getChunkData(&data)) | |||
| { | |||
| CARLA_SAFE_ASSERT_BREAK(data != nullptr); | |||
| String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName()); | |||
| filePath += OS_SEP_STR; | |||
| filePath += ".CarlaChunk_"; | |||
| filePath += fShmAudioPool.filename.buffer() + 18; | |||
| if (File(filePath).replaceWithText(chunkData)) | |||
| if (File(filePath).replaceWithData(data, dataSize)) | |||
| oscSend_bridge_set_chunk_data_file(filePath.toRawUTF8()); | |||
| } | |||
| } | |||
| @@ -28,6 +28,7 @@ | |||
| #include "CarlaPlugin.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaBinaryUtils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaStateUtils.hpp" | |||
| @@ -460,7 +461,10 @@ protected: | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(cdata), true); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| plugin->setChunkData(cdata); | |||
| { | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(cdata)); | |||
| plugin->setChunkData(chunk.data(), chunk.size()); | |||
| } | |||
| delete[] cdata; | |||
| } | |||
| @@ -21,7 +21,6 @@ | |||
| #ifndef BUILD_BRIDGE | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaBridgeUtils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaShmUtils.hpp" | |||
| @@ -380,8 +379,6 @@ public: | |||
| fShmNonRtControl.clear(); | |||
| clearBuffers(); | |||
| fInfo.chunk.clear(); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -427,10 +424,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.size() > 0, 0); | |||
| CARLA_SAFE_ASSERT_RETURN(fInfo.chunk.getSize() > 0, 0); | |||
| *dataPtr = fInfo.chunk.data(); | |||
| return fInfo.chunk.size(); | |||
| *dataPtr = fInfo.chunk.getData(); | |||
| return fInfo.chunk.getSize(); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -656,10 +653,11 @@ public: | |||
| } | |||
| #endif | |||
| void setChunkData(const char* const stringData) override | |||
| void setChunkData(const void* const data, const std::size_t dataSize) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS,); | |||
| CARLA_SAFE_ASSERT_RETURN(stringData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(dataSize > 0,); | |||
| String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName()); | |||
| @@ -667,7 +665,7 @@ public: | |||
| filePath += ".CarlaChunk_"; | |||
| filePath += fShmAudioPool.filename.buffer() + 18; | |||
| if (File(filePath).replaceWithText(stringData)) | |||
| if (File(filePath).replaceWithData(data, dataSize)) | |||
| { | |||
| const uint32_t ulength(static_cast<uint32_t>(filePath.length())); | |||
| @@ -1755,7 +1753,8 @@ public: | |||
| if (chunkFile.existsAsFile()) | |||
| { | |||
| fInfo.chunk = carla_getChunkFromBase64String(chunkFile.loadFileAsString().toRawUTF8()); | |||
| fInfo.chunk.reset(); | |||
| chunkFile.loadFileAsData(fInfo.chunk); | |||
| chunkFile.deleteFile(); | |||
| } | |||
| break; | |||
| @@ -2031,7 +2030,7 @@ private: | |||
| CarlaString label; | |||
| CarlaString maker; | |||
| CarlaString copyright; | |||
| std::vector<uint8_t> chunk; | |||
| MemoryBlock chunk; | |||
| Info() | |||
| : aIns(0), | |||
| @@ -19,6 +19,7 @@ | |||
| #include "CarlaEngine.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaPluginUI.hpp" | |||
| @@ -790,7 +791,10 @@ void CarlaPlugin::loadStateSave(const StateSave& stateSave) | |||
| // Part 6 - set chunk | |||
| if (stateSave.chunk != nullptr && (pData->options & PLUGIN_OPTION_USE_CHUNKS) != 0) | |||
| setChunkData(stateSave.chunk); | |||
| { | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(stateSave.chunk)); | |||
| setChunkData(chunk.data(), chunk.size()); | |||
| } | |||
| #ifndef BUILD_BRIDGE | |||
| // --------------------------------------------------------------- | |||
| @@ -1204,9 +1208,10 @@ void CarlaPlugin::setCustomData(const char* const type, const char* const key, c | |||
| pData->custom.append(newData); | |||
| } | |||
| void CarlaPlugin::setChunkData(const char* const stringData) | |||
| void CarlaPlugin::setChunkData(const void* const data, const std::size_t dataSize) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(stringData != nullptr && stringData[0] != '\0',); | |||
| CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(dataSize > 0,); | |||
| CARLA_SAFE_ASSERT(false); // this should never happen | |||
| } | |||
| @@ -19,8 +19,6 @@ | |||
| #include "CarlaEngine.hpp" | |||
| #include "CarlaDssiUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| CARLA_BACKEND_START_NAMESPACE | |||
| @@ -341,7 +339,7 @@ public: | |||
| CarlaPlugin::setCustomData(type, key, value, sendGui); | |||
| } | |||
| void setChunkData(const char* const stringData) override | |||
| void setChunkData(const void* const data, const std::size_t dataSize) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUsesCustomData,); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS,); | |||
| @@ -349,16 +347,14 @@ public: | |||
| CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor->set_custom_data != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(fHandle2 == nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(stringData != nullptr,); | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(stringData)); | |||
| CARLA_SAFE_ASSERT_RETURN(chunk.size() > 0,); | |||
| CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(dataSize > 0,); | |||
| { | |||
| const ScopedSingleProcessLocker spl(this, true); | |||
| try { | |||
| fDssiDescriptor->set_custom_data(fHandle, chunk.data(), chunk.size()); | |||
| fDssiDescriptor->set_custom_data(fHandle, const_cast<void*>(data), dataSize); | |||
| } CARLA_SAFE_EXCEPTION("DssiPlugin::setChunkData"); | |||
| } | |||
| @@ -21,7 +21,6 @@ | |||
| #if (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)) | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "JucePluginWindow.hpp" | |||
| #include "juce_audio_processors.h" | |||
| @@ -238,18 +237,16 @@ public: | |||
| CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); | |||
| } | |||
| void setChunkData(const char* const stringData) override | |||
| void setChunkData(const void* const data, const std::size_t dataSize) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS,); | |||
| CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(stringData != nullptr,); | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(stringData)); | |||
| CARLA_SAFE_ASSERT_RETURN(chunk.size() > 0,); | |||
| CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(dataSize > 0,); | |||
| { | |||
| const ScopedSingleProcessLocker spl(this, true); | |||
| fInstance->setStateInformation(chunk.data(), chunk.size()); | |||
| fInstance->setStateInformation(data, dataSize); | |||
| } | |||
| #ifdef BUILD_BRIDGE | |||
| @@ -26,7 +26,6 @@ | |||
| #include "CarlaVstUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaPluginUI.hpp" | |||
| @@ -328,29 +327,24 @@ public: | |||
| CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); | |||
| } | |||
| void setChunkData(const char* const stringData) override | |||
| void setChunkData(const void* const data, const std::size_t dataSize) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS,); | |||
| CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(stringData != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(dataSize > 0,); | |||
| if (fLastChunk != nullptr) | |||
| { | |||
| std::free(fLastChunk); | |||
| fLastChunk = nullptr; | |||
| } | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(stringData)); | |||
| CARLA_SAFE_ASSERT_RETURN(chunk.size() > 0,); | |||
| fLastChunk = std::malloc(chunk.size()); | |||
| fLastChunk = std::malloc(dataSize); | |||
| CARLA_SAFE_ASSERT_RETURN(fLastChunk != nullptr,); | |||
| std::memcpy(fLastChunk, chunk.data(), chunk.size()); | |||
| std::memcpy(fLastChunk, data, dataSize); | |||
| { | |||
| const ScopedSingleProcessLocker spl(this, true); | |||
| dispatcher(effSetChunk, 0 /* bank */, static_cast<intptr_t>(chunk.size()), fLastChunk, 0.0f); | |||
| dispatcher(effSetChunk, 0 /* bank */, static_cast<intptr_t>(dataSize), fLastChunk, 0.0f); | |||
| } | |||
| // simulate an updateDisplay callback | |||
| @@ -1775,22 +1769,24 @@ protected: | |||
| pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
| } | |||
| intptr_t dispatcher(int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) const | |||
| intptr_t dispatcher(int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, 0); | |||
| #ifdef DEBUG | |||
| if (opcode != effIdle && opcode != effEditIdle && opcode != effProcessEvents) | |||
| carla_debug("VstPlugin::dispatcher(%02i:%s, %i, " P_INTPTR ", %p, %f)", opcode, vstEffectOpcode2str(opcode), index, value, ptr, opt); | |||
| carla_debug("VstPlugin::dispatcher(%02i:%s, %i, " P_INTPTR ", %p, %f)", opcode, vstEffectOpcode2str(opcode), index, value, ptr, opt); | |||
| #endif | |||
| return fEffect->dispatcher(fEffect, opcode, index, value, ptr, opt); | |||
| try { | |||
| return fEffect->dispatcher(fEffect, opcode, index, value, ptr, opt); | |||
| } CARLA_SAFE_EXCEPTION_RETURN("Vst dispatcher", 0); | |||
| } | |||
| intptr_t handleAudioMasterCallback(const int32_t opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) | |||
| { | |||
| #ifdef DEBUG | |||
| if (opcode != audioMasterGetTime) | |||
| carla_debug("VstPlugin::handleAudioMasterCallback(%02i:%s, %i, " P_INTPTR ", %p, %f)", opcode, vstMasterOpcode2str(opcode), index, value, ptr, opt); | |||
| carla_debug("VstPlugin::handleAudioMasterCallback(%02i:%s, %i, " P_INTPTR ", %p, %f)", opcode, vstMasterOpcode2str(opcode), index, value, ptr, opt); | |||
| #endif | |||
| intptr_t ret = 0; | |||