Signed-off-by: falkTX <falktx@falktx.com>pull/1996/head
| @@ -522,25 +522,6 @@ endif | |||
| $(DESTDIR)$(INCLUDEDIR)/carla/includes | |||
| install -m 644 \ | |||
| source/utils/CarlaBackendUtils.hpp \ | |||
| source/utils/CarlaBase64Utils.hpp \ | |||
| source/utils/CarlaBinaryUtils.hpp \ | |||
| source/utils/CarlaBridgeDefines.hpp \ | |||
| source/utils/CarlaBridgeUtils.hpp \ | |||
| source/utils/CarlaMacUtils.hpp \ | |||
| source/utils/CarlaMathUtils.hpp \ | |||
| source/utils/CarlaMemUtils.hpp \ | |||
| source/utils/CarlaMutex.hpp \ | |||
| source/utils/CarlaRingBuffer.hpp \ | |||
| source/utils/CarlaProcessUtils.hpp \ | |||
| source/utils/CarlaRunner.hpp \ | |||
| source/utils/CarlaScopeUtils.hpp \ | |||
| source/utils/CarlaSemUtils.hpp \ | |||
| source/utils/CarlaSha1Utils.hpp \ | |||
| source/utils/CarlaShmUtils.hpp \ | |||
| source/utils/CarlaString.hpp \ | |||
| source/utils/CarlaThread.hpp \ | |||
| source/utils/CarlaTimeUtils.hpp \ | |||
| source/utils/CarlaUtils.hpp \ | |||
| $(DESTDIR)$(INCLUDEDIR)/carla/utils | |||
| @@ -21,10 +21,13 @@ cp -v ${DPF_DIR}/distrho/src/*.cpp ${CARLA_DIR}/source/modules/distrho/src/ | |||
| cp -v ${DPF_DIR}/distrho/src/*.h ${CARLA_DIR}/source/modules/distrho/src/ | |||
| cp -v ${DPF_DIR}/distrho/src/*.hpp ${CARLA_DIR}/source/modules/distrho/src/ | |||
| cp -v ${DPF_DIR}/distrho/extra/Base64.hpp ${CARLA_DIR}/source/modules/distrho/extra/ | |||
| cp -v ${DPF_DIR}/distrho/extra/LeakDetector.hpp ${CARLA_DIR}/source/modules/distrho/extra/ | |||
| cp -v ${DPF_DIR}/distrho/extra/ScopedPointer.hpp ${CARLA_DIR}/source/modules/distrho/extra/ | |||
| cp -v ${DPF_DIR}/distrho/extra/ScopedSafeLocale.hpp ${CARLA_DIR}/source/modules/distrho/extra/ | |||
| cp -v ${DPF_DIR}/distrho/extra/Sleep.hpp ${CARLA_DIR}/source/modules/distrho/extra/ | |||
| cp -v ${DPF_DIR}/distrho/extra/String.hpp ${CARLA_DIR}/source/modules/distrho/extra/ | |||
| cp -v ${DPF_DIR}/distrho/extra/Time.hpp ${CARLA_DIR}/source/modules/distrho/extra/ | |||
| cp -r -v ${DPF_DIR}/dgl/src/pugl-upstream/include ${CARLA_DIR}/source/modules/dgl/src/pugl-upstream/ | |||
| cp -r -v ${DPF_DIR}/dgl/src/pugl-upstream/src ${CARLA_DIR}/source/modules/dgl/src/pugl-upstream/ | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| // TODO: | |||
| @@ -11,9 +11,10 @@ | |||
| #include "CarlaPlugin.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "ThreadSafeFFTW.hpp" | |||
| #include "distrho/extra/Base64.hpp" | |||
| #include "water/files/File.h" | |||
| #define CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(cond, msg, ret) \ | |||
| @@ -2218,7 +2219,8 @@ void carla_set_chunk_data(CarlaHostHandle handle, uint pluginId, const char* chu | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS,); | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(chunkData)); | |||
| std::vector<uint8_t> chunk; | |||
| d_getChunkFromBase64String_impl(chunk, chunkData); | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| plugin->setChunkData(chunk.data(), chunk.size()); | |||
| #else | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaHostImpl.hpp" | |||
| @@ -289,7 +289,7 @@ protected: | |||
| projectPath); | |||
| for (; ! fReadyActionOpen;) | |||
| carla_msleep(10); | |||
| d_msleep(10); | |||
| } | |||
| else | |||
| { | |||
| @@ -343,7 +343,7 @@ protected: | |||
| 0, 0, 0.0f, nullptr); | |||
| for (; ! fReadyActionSave;) | |||
| carla_msleep(10); | |||
| d_msleep(10); | |||
| } | |||
| else | |||
| { | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #ifndef BUILD_BRIDGE | |||
| @@ -16,15 +16,16 @@ | |||
| #include "CarlaEngineInit.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaBridgeUtils.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "CarlaMIDI.h" | |||
| #ifdef __SSE2_MATH__ | |||
| # include <xmmintrin.h> | |||
| #endif | |||
| #include "distrho/extra/Base64.hpp" | |||
| #include "distrho/extra/Time.hpp" | |||
| #include "water/files/File.h" | |||
| #include "water/misc/Time.h" | |||
| @@ -368,7 +369,7 @@ public: | |||
| if (wasFirstIdle) | |||
| { | |||
| fFirstIdle = false; | |||
| fLastPingTime = carla_gettime_ms(); | |||
| fLastPingTime = d_gettime_ms(); | |||
| char bufStr[STR_MAX+1]; | |||
| carla_zeroChars(bufStr, STR_MAX+1); | |||
| @@ -643,7 +644,7 @@ public: | |||
| fShmNonRtServerControl.waitIfDataIsReachingLimit(); | |||
| carla_stdout("Carla Bridge Ready!"); | |||
| fLastPingTime = carla_gettime_ms(); | |||
| fLastPingTime = d_gettime_ms(); | |||
| } | |||
| // send parameter outputs | |||
| @@ -672,7 +673,7 @@ public: | |||
| handleNonRtData(); | |||
| } CARLA_SAFE_EXCEPTION("handleNonRtData"); | |||
| if (fLastPingTime != UINT32_MAX && carla_gettime_ms() > fLastPingTime + 30000 && ! wasFirstIdle) | |||
| if (fLastPingTime != UINT32_MAX && d_gettime_ms() > fLastPingTime + 30000 && ! wasFirstIdle) | |||
| { | |||
| carla_stderr("Did not receive ping message from server for 30 secs, closing..."); | |||
| signalThreadShouldExit(); | |||
| @@ -811,7 +812,7 @@ public: | |||
| if (opcode != kPluginBridgeNonRtClientNull && | |||
| opcode != kPluginBridgeNonRtClientPingOnOff && fLastPingTime != UINT32_MAX) | |||
| fLastPingTime = carla_gettime_ms(); | |||
| fLastPingTime = d_gettime_ms(); | |||
| switch (opcode) | |||
| { | |||
| @@ -832,7 +833,7 @@ public: | |||
| } break; | |||
| case kPluginBridgeNonRtClientPingOnOff: | |||
| fLastPingTime = fShmNonRtClientControl.readBool() ? carla_gettime_ms() : UINT32_MAX; | |||
| fLastPingTime = fShmNonRtClientControl.readBool() ? d_gettime_ms() : UINT32_MAX; | |||
| break; | |||
| case kPluginBridgeNonRtClientActivate: | |||
| @@ -981,7 +982,8 @@ public: | |||
| chunkFile.deleteFile(); | |||
| CARLA_SAFE_ASSERT_BREAK(chunkDataBase64.isNotEmpty()); | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(chunkDataBase64.toRawUTF8())); | |||
| std::vector<uint8_t> chunk; | |||
| d_getChunkFromBase64String_impl(chunk, chunkDataBase64.toRawUTF8()); | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| plugin->setChunkData(chunk.data(), chunk.size()); | |||
| @@ -1,24 +1,11 @@ | |||
| /* | |||
| * Carla Plugin Host | |||
| * Copyright (C) 2011-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 2 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 GPL.txt file | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaEngineGraph.hpp" | |||
| #include "CarlaEngineInit.hpp" | |||
| #include "CarlaEngineInternal.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "distrho/extra/Time.hpp" | |||
| CARLA_BACKEND_START_NAMESPACE | |||
| @@ -227,9 +214,9 @@ protected: | |||
| while (! shouldThreadExit()) | |||
| { | |||
| if (delay > 0) | |||
| carla_sleep(static_cast<uint>(delay)); | |||
| d_sleep(static_cast<uint>(delay)); | |||
| oldTime = carla_gettime_us(); | |||
| oldTime = d_gettime_us(); | |||
| const PendingRtEventsRunner prt(this, bufferSize, true); | |||
| @@ -239,7 +226,7 @@ protected: | |||
| pData->graph.process(pData, audioIns, audioOuts, bufferSize); | |||
| newTime = carla_gettime_us(); | |||
| newTime = d_gettime_us(); | |||
| CARLA_SAFE_ASSERT_CONTINUE(newTime >= oldTime); | |||
| const int64_t remainingTime = cycleTime - (newTime - oldTime); | |||
| @@ -253,7 +240,7 @@ protected: | |||
| else if (remainingTime >= 1000) | |||
| { | |||
| CARLA_SAFE_ASSERT_CONTINUE(remainingTime < 1000000); // 1 sec | |||
| carla_msleep(static_cast<uint>(remainingTime / 1000)); | |||
| d_msleep(static_cast<uint>(remainingTime / 1000)); | |||
| } | |||
| } | |||
| @@ -1,19 +1,5 @@ | |||
| /* | |||
| * Carla Plugin Host | |||
| * Copyright (C) 2011-2020 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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaEngineInternal.hpp" | |||
| #include "CarlaPlugin.hpp" | |||
| @@ -805,7 +791,7 @@ ScopedActionLock::ScopedActionLock(CarlaEngine* const engine, | |||
| } | |||
| else | |||
| { | |||
| carla_msleep(200); | |||
| d_msleep(200); | |||
| } | |||
| if (! engine->isRunning()) | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaEngineClient.hpp" | |||
| @@ -2747,7 +2747,7 @@ public: | |||
| if (groupId != 0) | |||
| break; | |||
| carla_msleep(100); | |||
| d_msleep(100); | |||
| callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
| } | |||
| } | |||
| @@ -4214,7 +4214,7 @@ private: | |||
| if (fClient == nullptr) | |||
| break; | |||
| carla_msleep(200); | |||
| d_msleep(200); | |||
| } | |||
| } | |||
| #endif // BUILD_BRIDGE | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaDefines.h" | |||
| @@ -16,7 +16,6 @@ | |||
| #include "CarlaPlugin.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaBinaryUtils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaStateUtils.hpp" | |||
| @@ -26,6 +25,8 @@ | |||
| #include "CarlaNative.hpp" | |||
| #include "CarlaNativePlugin.h" | |||
| #include "distrho/extra/Base64.hpp" | |||
| #include "water/files/File.h" | |||
| #include "water/streams/MemoryOutputStream.h" | |||
| #include "water/xml/XmlDocument.h" | |||
| @@ -2248,7 +2249,8 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept | |||
| if (const CarlaPluginPtr plugin = fEngine->getPlugin(pluginId)) | |||
| { | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(cdata)); | |||
| std::vector<uint8_t> chunk; | |||
| d_getChunkFromBase64String_impl(chunk, cdata); | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| plugin->setChunkData(chunk.data(), chunk.size()); | |||
| #else | |||
| @@ -1,19 +1,5 @@ | |||
| /* | |||
| * Carla Plugin Host | |||
| * Copyright (C) 2011-2022 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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaEngineGraph.hpp" | |||
| #include "CarlaEngineInit.hpp" | |||
| @@ -1,11 +1,10 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaPluginInternal.hpp" | |||
| #include "CarlaEngine.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaMIDI.h" | |||
| #include "CarlaPluginUI.hpp" | |||
| @@ -14,6 +13,8 @@ | |||
| #include <ctime> | |||
| #include "distrho/extra/Base64.hpp" | |||
| #include "water/files/File.h" | |||
| #include "water/streams/MemoryOutputStream.h" | |||
| #include "water/xml/XmlDocument.h" | |||
| @@ -924,7 +925,8 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) | |||
| if (stateSave.chunk != nullptr && (pData->options & PLUGIN_OPTION_USE_CHUNKS) != 0) | |||
| { | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(stateSave.chunk)); | |||
| std::vector<uint8_t> chunk; | |||
| d_getChunkFromBase64String_impl(chunk, stateSave.chunk); | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| setChunkData(chunk.data(), chunk.size()); | |||
| #else | |||
| @@ -1,37 +1,24 @@ | |||
| /* | |||
| * Carla Plugin Bridge | |||
| * Copyright (C) 2011-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaPluginInternal.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaBridgeUtils.hpp" | |||
| #include "CarlaEngineUtils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaPipeUtils.hpp" | |||
| #include "CarlaScopeUtils.hpp" | |||
| #include "CarlaShmUtils.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "CarlaThread.hpp" | |||
| #include "jackbridge/JackBridge.hpp" | |||
| #include <ctime> | |||
| #include "distrho/extra/Base64.hpp" | |||
| #include "distrho/extra/Time.hpp" | |||
| #include "water/files/File.h" | |||
| #include "water/misc/Time.h" | |||
| #include "water/threads/ChildProcess.h" | |||
| @@ -386,7 +373,7 @@ protected: | |||
| } | |||
| for (; fProcess->isRunning() && ! shouldThreadExit();) | |||
| carla_sleep(1); | |||
| d_msleep(100); | |||
| // we only get here if bridge crashed or thread asked to exit | |||
| if (fProcess->isRunning() && shouldThreadExit()) | |||
| @@ -690,10 +677,10 @@ public: | |||
| if (fReceivingParamText.wasDataReceived(&success)) | |||
| return success; | |||
| const uint32_t timeoutEnd = carla_gettime_ms() + 500; // 500 ms | |||
| const uint32_t timeoutEnd = d_gettime_ms() + 500; // 500 ms | |||
| const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin; | |||
| for (; carla_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) | |||
| for (; d_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) | |||
| { | |||
| if (fReceivingParamText.wasDataReceived(&success)) | |||
| return success; | |||
| @@ -701,7 +688,7 @@ public: | |||
| if (needsEngineIdle) | |||
| pData->engine->idle(); | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| } | |||
| if (! fBridgeThread.isThreadRunning()) | |||
| @@ -720,10 +707,10 @@ public: | |||
| return; | |||
| // TODO: only wait 1 minute for NI plugins | |||
| const uint32_t timeoutEnd = carla_gettime_ms() + 60*1000; // 60 secs, 1 minute | |||
| const uint32_t timeoutEnd = d_gettime_ms() + 60*1000; // 60 secs, 1 minute | |||
| const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin; | |||
| for (; carla_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) | |||
| for (; d_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) | |||
| { | |||
| pData->engine->callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
| @@ -733,7 +720,7 @@ public: | |||
| if (fSaved) | |||
| break; | |||
| carla_msleep(20); | |||
| d_msleep(20); | |||
| } | |||
| if (! fBridgeThread.isThreadRunning()) | |||
| @@ -1116,10 +1103,10 @@ public: | |||
| fShmNonRtClientControl.commitWrite(); | |||
| } | |||
| const uint32_t timeoutEnd = carla_gettime_ms() + 15*1000; // 15 secs | |||
| const uint32_t timeoutEnd = d_gettime_ms() + 15*1000; // 15 secs | |||
| const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin; | |||
| for (; carla_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) | |||
| for (; d_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) | |||
| { | |||
| pData->engine->callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
| @@ -1133,7 +1120,7 @@ public: | |||
| break; | |||
| } | |||
| carla_msleep(20); | |||
| d_msleep(20); | |||
| } | |||
| return reinterpret_cast<void*>(fPendingEmbedCustomUI); | |||
| @@ -2594,7 +2581,7 @@ public: | |||
| const File chunkFile(realChunkFilePath.toRawUTF8()); | |||
| CARLA_SAFE_ASSERT_BREAK(chunkFile.existsAsFile()); | |||
| fInfo.chunk = carla_getChunkFromBase64String(chunkFile.loadFileAsString().toRawUTF8()); | |||
| d_getChunkFromBase64String_impl(fInfo.chunk, chunkFile.loadFileAsString().toRawUTF8()); | |||
| chunkFile.deleteFile(); | |||
| } break; | |||
| @@ -3204,7 +3191,7 @@ private: | |||
| if (pData->engine->isAboutToClose() || pData->engine->wasActionCanceled()) | |||
| break; | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| } | |||
| #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaPluginInternal.hpp" | |||
| @@ -144,7 +144,7 @@ public: | |||
| if (sessionManager == LIBJACK_SESSION_MANAGER_NSM) | |||
| { | |||
| for (int i=50; fOscServer == nullptr && --i>=0;) | |||
| carla_msleep(100); | |||
| d_msleep(100); | |||
| ret += "export NSM_URL="; | |||
| ret += lo_server_get_url(fOscServer); | |||
| @@ -399,7 +399,7 @@ protected: | |||
| else | |||
| #endif | |||
| { | |||
| carla_msleep(50); | |||
| d_msleep(50); | |||
| } | |||
| } | |||
| @@ -1995,7 +1995,7 @@ private: | |||
| if (pData->engine->isAboutToClose() || pData->engine->wasActionCanceled()) | |||
| break; | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| } | |||
| if (needsCancelableAction) | |||
| @@ -1,19 +1,5 @@ | |||
| /* | |||
| * Carla Plugin, LADSPA/DSSI implementation | |||
| * Copyright (C) 2011-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaPluginInternal.hpp" | |||
| #include "CarlaEngineUtils.hpp" | |||
| @@ -209,7 +195,7 @@ public: | |||
| if (waitForOscGuiShow()) | |||
| { | |||
| for (; fProcess->isRunning() && ! shouldThreadExit();) | |||
| carla_sleep(1); | |||
| d_msleep(100); | |||
| // we only get here if UI was closed or thread asked to exit | |||
| if (fProcess->isRunning() && shouldThreadExit()) | |||
| @@ -274,7 +260,7 @@ private: | |||
| } | |||
| if (fProcess != nullptr && fProcess->isRunning() && ! shouldThreadExit()) | |||
| carla_msleep(100); | |||
| d_msleep(100); | |||
| else | |||
| return false; | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| // testing macros | |||
| @@ -11,13 +11,14 @@ | |||
| #include "CarlaLv2Utils.hpp" | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaEngineUtils.hpp" | |||
| #include "CarlaPipeUtils.hpp" | |||
| #include "CarlaPluginUI.hpp" | |||
| #include "CarlaScopeUtils.hpp" | |||
| #include "Lv2AtomRingBuffer.hpp" | |||
| #include "distrho/extra/Base64.hpp" | |||
| #include "../modules/lilv/config/lilv_config.h" | |||
| extern "C" { | |||
| @@ -1651,7 +1652,8 @@ public: | |||
| if (parameterId == UINT32_MAX) | |||
| break; | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(value)); | |||
| std::vector<uint8_t> chunk; | |||
| d_getChunkFromBase64String_impl(chunk, value); | |||
| CARLA_SAFE_ASSERT_RETURN(chunk.size() > 0,); | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| @@ -6047,7 +6049,8 @@ public: | |||
| fLastStateChunk = nullptr; | |||
| } | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(stringData)); | |||
| std::vector<uint8_t> chunk; | |||
| d_getChunkFromBase64String_impl(chunk, stringData); | |||
| CARLA_SAFE_ASSERT_RETURN(chunk.size() > 0, nullptr); | |||
| fLastStateChunk = std::malloc(chunk.size()); | |||
| @@ -8344,7 +8347,8 @@ bool CarlaPipeServerLV2::msgReceived(const char* const msg) noexcept | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(base64Size), true); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(base64atom, false, base64Size), true); | |||
| std::vector<uint8_t> chunk(carla_getChunkFromBase64String(base64atom)); | |||
| std::vector<uint8_t> chunk; | |||
| d_getChunkFromBase64String_impl(chunk, base64atom); | |||
| CARLA_SAFE_ASSERT_UINT2_RETURN(chunk.size() >= sizeof(LV2_Atom), chunk.size(), sizeof(LV2_Atom), true); | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaUtils.h" | |||
| @@ -8,7 +8,8 @@ | |||
| #include "CarlaJuceUtils.hpp" | |||
| #include "CarlaPipeUtils.hpp" | |||
| #include "CarlaSha1Utils.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "distrho/extra/Time.hpp" | |||
| #include "water/files/File.h" | |||
| #include "water/files/FileInputStream.h" | |||
| @@ -152,7 +153,7 @@ public: | |||
| idlePipe(); | |||
| // automatically skip a plugin if 30s passes without a reply | |||
| const uint32_t timeNow = carla_gettime_ms(); | |||
| const uint32_t timeNow = d_gettime_ms(); | |||
| if (timeNow - fLastMessageTime < 30000) | |||
| return true; | |||
| @@ -189,7 +190,7 @@ public: | |||
| protected: | |||
| bool msgReceived(const char* const msg) noexcept | |||
| { | |||
| fLastMessageTime = carla_gettime_ms(); | |||
| fLastMessageTime = d_gettime_ms(); | |||
| if (std::strcmp(msg, "warning") == 0 || std::strcmp(msg, "error") == 0) | |||
| { | |||
| @@ -396,7 +397,7 @@ private: | |||
| using water::File; | |||
| using water::String; | |||
| fLastMessageTime = carla_gettime_ms(); | |||
| fLastMessageTime = d_gettime_ms(); | |||
| fPluginsFoundInBinary = false; | |||
| fNextSha1Sum.clear(); | |||
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #ifndef BUILD_BRIDGE | |||
| @@ -12,7 +12,6 @@ | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaJuceUtils.hpp" | |||
| #include "CarlaMainLoop.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "CarlaMIDI.h" | |||
| @@ -38,6 +37,8 @@ | |||
| # include <X11/Xlib.h> | |||
| #endif | |||
| #include "distrho/extra/Sleep.hpp" | |||
| #include "water/files/File.h" | |||
| #include "water/misc/Time.h" | |||
| @@ -230,9 +231,9 @@ public: | |||
| gIdle(); | |||
| #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | |||
| // MacOS and Win32 have event-loops to run, so minimize sleep time | |||
| carla_msleep(1); | |||
| d_msleep(1); | |||
| #else | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| #endif | |||
| if (testing && timeToEnd - water::Time::currentTimeMillis() < 0) | |||
| break; | |||
| @@ -1,29 +1,16 @@ | |||
| /* | |||
| * Carla Bridge UI | |||
| * Copyright (C) 2011-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaBridgeFormat.hpp" | |||
| #include "CarlaBridgeToolkit.hpp" | |||
| #include "CarlaBase64Utils.hpp" | |||
| #include "CarlaProcessUtils.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "CarlaMIDI.h" | |||
| #include "distrho/extra/Base64.hpp" | |||
| #include "distrho/extra/Sleep.hpp" | |||
| // needed for atom-util | |||
| #ifndef nullptr | |||
| # undef NULL | |||
| @@ -127,7 +114,7 @@ bool CarlaBridgeFormat::msgReceived(const char* const msg) noexcept | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(base64Size), true); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(base64atom, false, base64Size), true); | |||
| carla_getChunkFromBase64String_impl(fBase64ReservedChunk, base64atom); | |||
| d_getChunkFromBase64String_impl(fBase64ReservedChunk, base64atom); | |||
| CARLA_SAFE_ASSERT_UINT2_RETURN(fBase64ReservedChunk.size() >= sizeof(LV2_Atom), | |||
| fBase64ReservedChunk.size(), sizeof(LV2_Atom), true); | |||
| @@ -320,7 +307,7 @@ bool CarlaBridgeFormat::init(const int argc, const char* argv[]) | |||
| for (; ++fLastMsgTimer < 50 && ! fGotOptions;) | |||
| { | |||
| idlePipe(true); | |||
| carla_msleep(20); | |||
| d_msleep(20); | |||
| } | |||
| if (! fGotOptions) | |||
| @@ -1,32 +1,19 @@ | |||
| /* | |||
| * Carla Bridge UI | |||
| * Copyright (C) 2014-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaBridgeFormat.hpp" | |||
| #include "CarlaBridgeToolkit.hpp" | |||
| #include "CarlaMainLoop.hpp" | |||
| #include "CarlaPluginUI.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "CarlaUtils.h" | |||
| #if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA) | |||
| # include "CarlaMacUtils.hpp" | |||
| #endif | |||
| #include "distrho/extra/Sleep.hpp" | |||
| #if defined(HAVE_X11) && defined(BRIDGE_X11) | |||
| # include <X11/Xlib.h> | |||
| #endif | |||
| @@ -118,9 +105,9 @@ public: | |||
| fHostUI->idle(); | |||
| #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | |||
| // MacOS and Win32 have event-loops to run, so minimize sleep time | |||
| carla_msleep(1); | |||
| d_msleep(1); | |||
| #else | |||
| carla_msleep(33); | |||
| d_msleep(33); | |||
| #endif | |||
| } | |||
| } | |||
| @@ -22,7 +22,7 @@ endif | |||
| # --------------------------------------------------------------------------------------------------------------------- | |||
| BUILD_CXX_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_UI -I. -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/utils -I$(CWD)/modules | |||
| BUILD_CXX_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_UI -I. -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/modules -I$(CWD)/utils | |||
| LINK_FLAGS += $(WATER_LIBS) | |||
| ifneq ($(WASM),true) | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * JackBridge (Part 2, Semaphore + Shared memory and other misc functions) | |||
| * Copyright (C) 2013-2023 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2013-2025 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -19,10 +19,13 @@ | |||
| #ifdef JACKBRIDGE_DUMMY | |||
| # include "CarlaUtils.hpp" | |||
| #else | |||
| # ifdef __WINE__ | |||
| # define NOMINMAX | |||
| # include <winsock2.h> | |||
| # endif | |||
| # include "CarlaProcessUtils.hpp" | |||
| # include "CarlaSemUtils.hpp" | |||
| # include "CarlaShmUtils.hpp" | |||
| # include "CarlaTimeUtils.hpp" | |||
| # ifdef __WINE__ | |||
| # include "utils/PipeClient.cpp" | |||
| # endif | |||
| @@ -191,7 +194,7 @@ void jackbridge_discovery_pipe_destroy(void* pipe) | |||
| for (int i=0; i < 100 && carla_pipe_client_is_running(pipe); ++i) | |||
| { | |||
| carla_msleep(50); | |||
| d_msleep(50); | |||
| carla_pipe_client_idle(pipe); | |||
| } | |||
| @@ -10,7 +10,7 @@ include ../modules/Makefile.mk | |||
| # --------------------------------------------------------------------------------------------------------------------- | |||
| BUILD_CXX_FLAGS += $(JACKBRIDGE_FLAGS) -I../backend | |||
| BUILD_CXX_FLAGS += $(JACKBRIDGE_FLAGS) -I../backend -I../modules | |||
| LINK_FLAGS += $(JACKBRIDGE_LIBS) | |||
| ifeq ($(JACKBRIDGE_DIRECT),true) | |||
| @@ -18,12 +18,6 @@ BUILD_CXX_FLAGS += $(JACK_FLAGS) -DJACKBRIDGE_DIRECT | |||
| LINK_FLAGS += $(JACK_LIBS) | |||
| endif | |||
| ifneq ($(BUILDING_FOR_WINE),true) | |||
| ifeq ($(WINDOWS),true) | |||
| BUILD_CXX_FLAGS += -I../modules | |||
| endif | |||
| endif | |||
| WINE_32BIT_FLAGS = $(32BIT_FLAGS) -fpermissive | |||
| WINE_64BIT_FLAGS = $(64BIT_FLAGS) -fpermissive | |||
| WINE_BUILD_FLAGS = $(filter-out -flto,$(BUILD_CXX_FLAGS)) | |||
| @@ -22,7 +22,7 @@ endif | |||
| # --------------------------------------------------------------------------------------------------------------------- | |||
| BUILD_C_FLAGS += -I$(CWD) -I$(CWD)/includes | |||
| BUILD_CXX_FLAGS += -I$(CWD) -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/utils | |||
| BUILD_CXX_FLAGS += -I$(CWD) -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/modules -I$(CWD)/utils | |||
| LINK_FLAGS += -pthread | |||
| ifeq ($(LINUX),true) | |||
| LINK_FLAGS += -lrt | |||
| @@ -1,25 +1,13 @@ | |||
| /* | |||
| * Carla JACK API for external applications | |||
| * Copyright (C) 2016-2022 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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "libjack.hpp" | |||
| #include "CarlaThread.hpp" | |||
| #include "CarlaJuceUtils.hpp" | |||
| #include "distrho/extra/Time.hpp" | |||
| #include <signal.h> | |||
| #include <sys/time.h> | |||
| @@ -29,13 +17,6 @@ CARLA_BACKEND_START_NAMESPACE | |||
| // --------------------------------------------------------------------------------------------------------------------- | |||
| static int64_t getCurrentTimeMilliseconds() noexcept | |||
| { | |||
| struct timeval tv; | |||
| gettimeofday (&tv, nullptr); | |||
| return ((int64_t) tv.tv_sec) * 1000 + tv.tv_usec / 1000; | |||
| } | |||
| static int carla_interposed_callback(int, void*); | |||
| // --------------------------------------------------------------------------------------------------------------------- | |||
| @@ -220,7 +201,7 @@ public: | |||
| return nullptr; | |||
| while (fNonRealtimeThread.isThreadRunning() && ! fIsReady) | |||
| carla_sleep(1); | |||
| d_msleep(100); | |||
| return new JackClientState(fServer, name); | |||
| } | |||
| @@ -456,7 +437,7 @@ bool CarlaJackAppClient::initSharedMemmory() | |||
| fAudioTmpBuf = new float[fServer.bufferSize]; | |||
| carla_zeroFloats(fAudioTmpBuf, fServer.bufferSize); | |||
| fLastPingTime = getCurrentTimeMilliseconds(); | |||
| fLastPingTime = d_gettime_ms(); | |||
| CARLA_SAFE_ASSERT(fLastPingTime > 0); | |||
| { | |||
| @@ -1154,7 +1135,7 @@ bool CarlaJackAppClient::handleNonRtData() | |||
| #endif | |||
| if (opcode != kPluginBridgeNonRtClientNull && opcode != kPluginBridgeNonRtClientPingOnOff && fLastPingTime > 0) | |||
| fLastPingTime = getCurrentTimeMilliseconds(); | |||
| fLastPingTime = d_gettime_ms(); | |||
| switch (opcode) | |||
| { | |||
| @@ -1177,7 +1158,7 @@ bool CarlaJackAppClient::handleNonRtData() | |||
| case kPluginBridgeNonRtClientPingOnOff: { | |||
| const uint32_t onOff(fShmNonRtClientControl.readBool()); | |||
| fLastPingTime = onOff ? getCurrentTimeMilliseconds() : -1; | |||
| fLastPingTime = onOff ? d_gettime_ms() : -1; | |||
| } break; | |||
| case kPluginBridgeNonRtClientActivate: | |||
| @@ -1347,7 +1328,7 @@ void CarlaJackAppClient::runNonRealtimeThread() | |||
| fRealtimeThread.startThread(true); | |||
| fLastPingTime = getCurrentTimeMilliseconds(); | |||
| fLastPingTime = d_gettime_ms(); | |||
| carla_stdout("Carla Jack Client Ready!"); | |||
| bool quitReceived = false, | |||
| @@ -1355,7 +1336,7 @@ void CarlaJackAppClient::runNonRealtimeThread() | |||
| for (; ! fNonRealtimeThread.shouldThreadExit();) | |||
| { | |||
| carla_msleep(50); | |||
| d_msleep(50); | |||
| try { | |||
| quitReceived = handleNonRtData(); | |||
| @@ -1365,7 +1346,7 @@ void CarlaJackAppClient::runNonRealtimeThread() | |||
| break; | |||
| /* | |||
| if (fLastPingTime > 0 && getCurrentTimeMilliseconds() > fLastPingTime + 30000) | |||
| if (fLastPingTime > 0 && d_gettime_ms() > fLastPingTime + 30000) | |||
| { | |||
| carla_stderr("Did not receive ping message from server for 30 secs, closing..."); | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -23,6 +23,13 @@ | |||
| # define __STDC_LIMIT_MACROS | |||
| #endif | |||
| #ifdef __WINE__ | |||
| # ifndef NOMINMAX | |||
| # define NOMINMAX | |||
| # endif | |||
| # include <winsock2.h> | |||
| #endif | |||
| #include <cstdarg> | |||
| #include <cstdio> | |||
| #include <cstdlib> | |||
| @@ -0,0 +1,155 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| * permission notice appear in all copies. | |||
| * | |||
| * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD | |||
| * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN | |||
| * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |||
| * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER | |||
| * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |||
| * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |||
| */ | |||
| #ifndef DISTRHO_BASE64_HPP_INCLUDED | |||
| #define DISTRHO_BASE64_HPP_INCLUDED | |||
| #include "../DistrhoUtils.hpp" | |||
| #include <vector> | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| // base64 stuff, based on http://www.adp-gmbh.ch/cpp/common/base64.html | |||
| /* | |||
| Copyright (C) 2004-2008 René Nyffenegger | |||
| This source code is provided 'as-is', without any express or implied | |||
| warranty. In no event will the author be held liable for any damages | |||
| arising from the use of this software. | |||
| Permission is granted to anyone to use this software for any purpose, | |||
| including commercial applications, and to alter it and redistribute it | |||
| freely, subject to the following restrictions: | |||
| 1. The origin of this source code must not be misrepresented; you must not | |||
| claim that you wrote the original source code. If you use this source code | |||
| in a product, an acknowledgment in the product documentation would be | |||
| appreciated but is not required. | |||
| 2. Altered source versions must be plainly marked as such, and must not be | |||
| misrepresented as being the original source code. | |||
| 3. This notice may not be removed or altered from any source distribution. | |||
| René Nyffenegger rene.nyffenegger@adp-gmbh.ch | |||
| */ | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| // Helpers | |||
| #ifndef DOXYGEN | |||
| namespace DistrhoBase64Helpers { | |||
| static constexpr const char* const kBase64Chars = | |||
| "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |||
| "abcdefghijklmnopqrstuvwxyz" | |||
| "0123456789+/"; | |||
| static inline | |||
| uint8_t findBase64CharIndex(const char c) | |||
| { | |||
| static const uint8_t kBase64CharsLen = static_cast<uint8_t>(std::strlen(kBase64Chars)); | |||
| for (uint8_t i=0; i<kBase64CharsLen; ++i) | |||
| { | |||
| if (kBase64Chars[i] == c) | |||
| return i; | |||
| } | |||
| d_stderr2("findBase64CharIndex('%c') - failed", c); | |||
| return 0; | |||
| } | |||
| static constexpr inline | |||
| bool isBase64Char(const char c) | |||
| { | |||
| return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '+' || c == '/'; | |||
| } | |||
| } // namespace DistrhoBase64Helpers | |||
| #endif | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| static inline | |||
| void d_getChunkFromBase64String_impl(std::vector<uint8_t>& vector, const char* const base64string) | |||
| { | |||
| vector.clear(); | |||
| DISTRHO_SAFE_ASSERT_RETURN(base64string != nullptr,); | |||
| uint i=0, j=0; | |||
| uint charArray3[3], charArray4[4]; | |||
| vector.reserve(std::strlen(base64string)*3/4 + 4); | |||
| for (std::size_t l=0, len=std::strlen(base64string); l<len; ++l) | |||
| { | |||
| const char c = base64string[l]; | |||
| if (c == '\0' || c == '=') | |||
| break; | |||
| if (c == ' ' || c == '\n') | |||
| continue; | |||
| DISTRHO_SAFE_ASSERT_CONTINUE(DistrhoBase64Helpers::isBase64Char(c)); | |||
| charArray4[i++] = static_cast<uint>(c); | |||
| if (i == 4) | |||
| { | |||
| for (i=0; i<4; ++i) | |||
| charArray4[i] = DistrhoBase64Helpers::findBase64CharIndex(static_cast<char>(charArray4[i])); | |||
| charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4); | |||
| charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2); | |||
| charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3]; | |||
| for (i=0; i<3; ++i) | |||
| vector.push_back(static_cast<uint8_t>(charArray3[i])); | |||
| i = 0; | |||
| } | |||
| } | |||
| if (i != 0) | |||
| { | |||
| for (j=0; j<i && j<4; ++j) | |||
| charArray4[j] = DistrhoBase64Helpers::findBase64CharIndex(static_cast<char>(charArray4[j])); | |||
| for (j=i; j<4; ++j) | |||
| charArray4[j] = 0; | |||
| charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4); | |||
| charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2); | |||
| charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3]; | |||
| for (j=0; i>0 && j<i-1; j++) | |||
| vector.push_back(static_cast<uint8_t>(charArray3[j])); | |||
| } | |||
| } | |||
| static inline | |||
| std::vector<uint8_t> d_getChunkFromBase64String(const char* const base64string) | |||
| { | |||
| std::vector<uint8_t> ret; | |||
| d_getChunkFromBase64String_impl(ret, base64string); | |||
| return ret; | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| #endif // DISTRHO_BASE64_HPP_INCLUDED | |||
| @@ -0,0 +1,75 @@ | |||
| /* | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| * permission notice appear in all copies. | |||
| * | |||
| * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD | |||
| * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN | |||
| * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |||
| * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER | |||
| * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |||
| * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |||
| */ | |||
| #ifndef DISTRHO_SLEEP_HPP_INCLUDED | |||
| #define DISTRHO_SLEEP_HPP_INCLUDED | |||
| #include "../DistrhoUtils.hpp" | |||
| #ifdef DISTRHO_OS_WINDOWS | |||
| # ifndef NOMINMAX | |||
| # define NOMINMAX | |||
| # endif | |||
| # include <winsock2.h> | |||
| # include <windows.h> | |||
| #else | |||
| # include <unistd.h> | |||
| #endif | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| // d_*sleep | |||
| /* | |||
| * Sleep for 'secs' seconds. | |||
| */ | |||
| static inline | |||
| void d_sleep(const uint secs) noexcept | |||
| { | |||
| DISTRHO_SAFE_ASSERT_RETURN(secs > 0,); | |||
| try { | |||
| #ifdef DISTRHO_OS_WINDOWS | |||
| ::Sleep(secs * 1000); | |||
| #else | |||
| ::sleep(secs); | |||
| #endif | |||
| } DISTRHO_SAFE_EXCEPTION("d_sleep"); | |||
| } | |||
| /* | |||
| * Sleep for 'msecs' milliseconds. | |||
| */ | |||
| static inline | |||
| void d_msleep(const uint msecs) noexcept | |||
| { | |||
| DISTRHO_SAFE_ASSERT_RETURN(msecs > 0,); | |||
| try { | |||
| #ifdef DISTRHO_OS_WINDOWS | |||
| ::Sleep(msecs); | |||
| #else | |||
| ::usleep(msecs * 1000); | |||
| #endif | |||
| } DISTRHO_SAFE_EXCEPTION("d_msleep"); | |||
| } | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // DISTRHO_SLEEP_HPP_INCLUDED | |||
| @@ -1,81 +1,47 @@ | |||
| /* | |||
| * Carla time utils | |||
| * Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com> | |||
| * DISTRHO Plugin Framework (DPF) | |||
| * Copyright (C) 2012-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 2 of | |||
| * the License, or any later version. | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| * permission notice appear in all copies. | |||
| * | |||
| * 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 doc/GPL.txt file. | |||
| * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD | |||
| * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN | |||
| * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |||
| * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER | |||
| * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |||
| * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |||
| */ | |||
| #ifndef CARLA_TIME_UTILS_HPP_INCLUDED | |||
| #define CARLA_TIME_UTILS_HPP_INCLUDED | |||
| #include "CarlaUtils.hpp" | |||
| #ifndef DISTRHO_TIME_HPP_INCLUDED | |||
| #define DISTRHO_TIME_HPP_INCLUDED | |||
| #include <ctime> | |||
| #include "../DistrhoUtils.hpp" | |||
| #ifdef CARLA_OS_WIN | |||
| #ifdef DISTRHO_OS_WINDOWS | |||
| # include <winsock2.h> | |||
| # include <windows.h> | |||
| # include <mmsystem.h> | |||
| #else | |||
| # include <ctime> | |||
| #endif | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| // carla_*sleep | |||
| START_NAMESPACE_DISTRHO | |||
| /* | |||
| * Sleep for 'secs' seconds. | |||
| */ | |||
| static inline | |||
| void carla_sleep(const uint secs) noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(secs > 0,); | |||
| try { | |||
| #ifdef CARLA_OS_WIN | |||
| ::Sleep(secs * 1000); | |||
| #else | |||
| ::sleep(secs); | |||
| #endif | |||
| } CARLA_SAFE_EXCEPTION("carla_sleep"); | |||
| } | |||
| /* | |||
| * Sleep for 'msecs' milliseconds. | |||
| */ | |||
| static inline | |||
| void carla_msleep(const uint msecs) noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(msecs > 0,); | |||
| try { | |||
| #ifdef CARLA_OS_WIN | |||
| ::Sleep(msecs); | |||
| #else | |||
| ::usleep(msecs * 1000); | |||
| #endif | |||
| } CARLA_SAFE_EXCEPTION("carla_msleep"); | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| // carla_gettime_* | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| // d_gettime_* | |||
| /* | |||
| * Get a monotonically-increasing time in milliseconds. | |||
| */ | |||
| static inline | |||
| uint32_t carla_gettime_ms() noexcept | |||
| uint32_t d_gettime_ms() noexcept | |||
| { | |||
| #if defined(CARLA_OS_MAC) | |||
| #if defined(DISTRHO_OS_MAC) | |||
| static const time_t s = clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / 1000000; | |||
| return (clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / 1000000) - s; | |||
| #elif defined(CARLA_OS_WIN) | |||
| #elif defined(DISTRHO_OS_WINDOWS) | |||
| return static_cast<uint32_t>(timeGetTime()); | |||
| #else | |||
| static struct { | |||
| @@ -94,12 +60,12 @@ uint32_t carla_gettime_ms() noexcept | |||
| * Get a monotonically-increasing time in microseconds. | |||
| */ | |||
| static inline | |||
| uint64_t carla_gettime_us() noexcept | |||
| uint64_t d_gettime_us() noexcept | |||
| { | |||
| #if defined(CARLA_OS_MAC) | |||
| #if defined(DISTRHO_OS_MAC) | |||
| static const uint64_t s = clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / 1000; | |||
| return (clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / 1000) - s; | |||
| #elif defined(CARLA_OS_WIN) | |||
| #elif defined(DISTRHO_OS_WINDOWS) | |||
| static struct { | |||
| LARGE_INTEGER freq; | |||
| LARGE_INTEGER counter; | |||
| @@ -126,12 +92,12 @@ uint64_t carla_gettime_us() noexcept | |||
| * Get a monotonically-increasing time in nanoseconds. | |||
| */ | |||
| static inline | |||
| uint64_t carla_gettime_ns() noexcept | |||
| uint64_t d_gettime_ns() noexcept | |||
| { | |||
| #if defined(CARLA_OS_MAC) | |||
| #if defined(DISTRHO_OS_MAC) | |||
| static const uint64_t s = clock_gettime_nsec_np(CLOCK_UPTIME_RAW); | |||
| return clock_gettime_nsec_np(CLOCK_UPTIME_RAW) - s; | |||
| #elif defined(CARLA_OS_WIN) | |||
| #elif defined(DISTRHO_OS_WINDOWS) | |||
| static struct { | |||
| LARGE_INTEGER freq; | |||
| LARGE_INTEGER counter; | |||
| @@ -154,6 +120,8 @@ uint64_t carla_gettime_ns() noexcept | |||
| #endif | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| // ----------------------------------------------------------------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // CARLA_TIME_UTILS_HPP_INCLUDED | |||
| #endif // DISTRHO_TIME_HPP_INCLUDED | |||
| @@ -3,7 +3,7 @@ | |||
| This file is part of the Water library. | |||
| Copyright (c) 2016 ROLI Ltd. | |||
| Copyright (C) 2017-2023 Filipe Coelho <falktx@falktx.com> | |||
| Copyright (C) 2017-2025 Filipe Coelho <falktx@falktx.com> | |||
| Permission is granted to use this software under the terms of the ISC license | |||
| http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
| @@ -26,7 +26,7 @@ | |||
| #include "TemporaryFile.h" | |||
| #include "../maths/Random.h" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "distrho/extra/Sleep.hpp" | |||
| namespace water { | |||
| @@ -93,7 +93,7 @@ bool TemporaryFile::overwriteTargetFileWithTemporary() const | |||
| if (temporaryFile.replaceFileIn (targetFile)) | |||
| return true; | |||
| carla_msleep (100); | |||
| d_msleep (100); | |||
| } | |||
| } | |||
| else | |||
| @@ -114,7 +114,7 @@ bool TemporaryFile::deleteTemporaryFile() const | |||
| if (temporaryFile.deleteFile()) | |||
| return true; | |||
| carla_msleep (50); | |||
| d_msleep (50); | |||
| } | |||
| return false; | |||
| @@ -3,7 +3,7 @@ | |||
| This file is part of the Water library. | |||
| Copyright (c) 2016 ROLI Ltd. | |||
| Copyright (C) 2017-2024 Filipe Coelho <falktx@falktx.com> | |||
| Copyright (C) 2017-2025 Filipe Coelho <falktx@falktx.com> | |||
| Permission is granted to use this software under the terms of the ISC license | |||
| http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
| @@ -39,6 +39,8 @@ | |||
| #include "CarlaProcessUtils.hpp" | |||
| #include "distrho/extra/Sleep.hpp" | |||
| namespace water { | |||
| #ifdef CARLA_OS_WIN | |||
| @@ -311,7 +313,7 @@ bool ChildProcess::waitForProcessToFinish (const int timeoutMs) | |||
| if (! activeProcess->checkRunningAndUnsetPID()) | |||
| return true; | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| } | |||
| while (timeoutMs < 0 || Time::getMillisecondCounter() < timeoutTime); | |||
| @@ -179,7 +179,7 @@ LIBS_wine += $(MODULEDIR)/water.files.a | |||
| WINE_LINK_FLAGS = $(LINK_FLAGS) | |||
| WINE_LINK_FLAGS += -L$(BINDIR) -lcarla_native-plugin | |||
| WINE_LINK_FLAGS += -lstdc++ -lopengl32 -lgdi32 -ldl | |||
| WINE_LINK_FLAGS += -lstdc++ -lopengl32 -lgdi32 -ldwmapi -ldl | |||
| WINE_LINK_FLAGS += -Wl,-rpath,/usr/local/lib/carla | |||
| WINE_LINK_FLAGS += -Wl,-rpath,/usr/lib/carla | |||
| @@ -1,19 +1,5 @@ | |||
| /* | |||
| * Carla Native Plugin UI launcher | |||
| * Copyright (C) 2018-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "dgl/OpenGL.hpp" | |||
| #include "dgl/src/pugl.hpp" | |||
| @@ -1,130 +0,0 @@ | |||
| /* | |||
| * Carla base64 utils, based on http://www.adp-gmbh.ch/cpp/common/base64.html | |||
| * Copyright (C) 2004-2008 René Nyffenegger | |||
| * Copyright (C) 2014 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 2 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 doc/GPL.txt file. | |||
| */ | |||
| #ifndef CARLA_BASE64_UTILS_HPP_INCLUDED | |||
| #define CARLA_BASE64_UTILS_HPP_INCLUDED | |||
| #include "CarlaUtils.hpp" | |||
| #include <cctype> | |||
| #include <vector> | |||
| // ----------------------------------------------------------------------- | |||
| // Helpers | |||
| namespace CarlaBase64Helpers { | |||
| static const char* const kBase64Chars = | |||
| "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |||
| "abcdefghijklmnopqrstuvwxyz" | |||
| "0123456789+/"; | |||
| static inline | |||
| uint8_t findBase64CharIndex(const char c) | |||
| { | |||
| static const uint8_t kBase64CharsLen(static_cast<uint8_t>(std::strlen(kBase64Chars))); | |||
| for (uint8_t i=0; i<kBase64CharsLen; ++i) | |||
| { | |||
| if (kBase64Chars[i] == c) | |||
| return i; | |||
| } | |||
| carla_stderr2("findBase64CharIndex('%c') - failed", c); | |||
| return 0; | |||
| } | |||
| static inline | |||
| bool isBase64Char(const char c) | |||
| { | |||
| return (std::isalnum(c) || (c == '+') || (c == '/')); | |||
| } | |||
| } // namespace CarlaBase64Helpers | |||
| // ----------------------------------------------------------------------- | |||
| static inline | |||
| void carla_getChunkFromBase64String_impl(std::vector<uint8_t>& vector, const char* const base64string) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(base64string != nullptr,); | |||
| uint i=0, j=0; | |||
| uint charArray3[3], charArray4[4]; | |||
| vector.clear(); | |||
| vector.reserve(std::strlen(base64string)*3/4 + 4); | |||
| for (std::size_t l=0, len=std::strlen(base64string); l<len; ++l) | |||
| { | |||
| const char c = base64string[l]; | |||
| if (c == '\0' || c == '=') | |||
| break; | |||
| if (c == ' ' || c == '\n') | |||
| continue; | |||
| CARLA_SAFE_ASSERT_CONTINUE(CarlaBase64Helpers::isBase64Char(c)); | |||
| charArray4[i++] = static_cast<uint>(c); | |||
| if (i == 4) | |||
| { | |||
| for (i=0; i<4; ++i) | |||
| charArray4[i] = CarlaBase64Helpers::findBase64CharIndex(static_cast<char>(charArray4[i])); | |||
| charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4); | |||
| charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2); | |||
| charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3]; | |||
| for (i=0; i<3; ++i) | |||
| vector.push_back(static_cast<uint8_t>(charArray3[i])); | |||
| i = 0; | |||
| } | |||
| } | |||
| if (i != 0) | |||
| { | |||
| for (j=0; j<i && j<4; ++j) | |||
| charArray4[j] = CarlaBase64Helpers::findBase64CharIndex(static_cast<char>(charArray4[j])); | |||
| for (j=i; j<4; ++j) | |||
| charArray4[j] = 0; | |||
| charArray3[0] = (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4); | |||
| charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2); | |||
| charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3]; | |||
| for (j=0; i>0 && j<i-1; j++) | |||
| vector.push_back(static_cast<uint8_t>(charArray3[j])); | |||
| } | |||
| } | |||
| static inline | |||
| std::vector<uint8_t> carla_getChunkFromBase64String(const char* const base64string) | |||
| { | |||
| std::vector<uint8_t> ret; | |||
| carla_getChunkFromBase64String_impl(ret, base64string); | |||
| return ret; | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| #endif // CARLA_BASE64_UTILS_HPP_INCLUDED | |||
| @@ -1,23 +1,10 @@ | |||
| /* | |||
| * Carla Bridge utils | |||
| * Copyright (C) 2013-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaBridgeUtils.hpp" | |||
| #include "CarlaShmUtils.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "distrho/extra/Sleep.hpp" | |||
| // must be last | |||
| #include "jackbridge/JackBridge.hpp" | |||
| @@ -436,7 +423,7 @@ void BridgeNonRtClientControl::waitIfDataIsReachingLimit() noexcept | |||
| commitWrite(); | |||
| return; | |||
| } | |||
| carla_msleep(20); | |||
| d_msleep(20); | |||
| } | |||
| carla_stderr("Server waitIfDataIsReachingLimit() reached and failed"); | |||
| @@ -581,7 +568,7 @@ void BridgeNonRtServerControl::waitIfDataIsReachingLimit() noexcept | |||
| commitWrite(); | |||
| return; | |||
| } | |||
| carla_msleep(20); | |||
| d_msleep(20); | |||
| } | |||
| carla_stderr("Client waitIfDataIsReachingLimit() reached and failed"); | |||
| @@ -1,19 +1,5 @@ | |||
| /* | |||
| * Carla Log Thread | |||
| * Copyright (C) 2013-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #ifndef CARLA_LOG_THREAD_HPP_INCLUDED | |||
| #define CARLA_LOG_THREAD_HPP_INCLUDED | |||
| @@ -199,7 +185,7 @@ protected: | |||
| } | |||
| } | |||
| carla_msleep(20); | |||
| d_msleep(20); | |||
| } | |||
| } | |||
| @@ -1,26 +1,14 @@ | |||
| /* | |||
| * Carla Pipe Utilities | |||
| * Copyright (C) 2013-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #include "CarlaPipeUtils.hpp" | |||
| #include "CarlaProcessUtils.hpp" | |||
| #include "CarlaString.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "CarlaMIDI.h" | |||
| #include "distrho/extra/Sleep.hpp" | |||
| #include "distrho/extra/Time.hpp" | |||
| // needed for atom-util | |||
| #ifndef nullptr | |||
| # undef NULL | |||
| @@ -109,7 +97,7 @@ bool waitForAsyncObject(const HANDLE object, const HANDLE process = INVALID_HAND | |||
| } | |||
| carla_stderr2("waitForAsyncObject loop end reached, error was: %u", dw2); | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| } | |||
| carla_stderr2("waitForAsyncObject reached the end, this should not happen"); | |||
| @@ -265,7 +253,7 @@ bool waitForClientConnect(const HANDLE pipe, const HANDLE event, const HANDLE pr | |||
| carla_zeroStruct(ov); | |||
| ov.hEvent = event; | |||
| const uint32_t timeoutEnd = carla_gettime_ms() + timeOutMilliseconds; | |||
| const uint32_t timeoutEnd = d_gettime_ms() + timeOutMilliseconds; | |||
| for (;;) | |||
| { | |||
| @@ -303,9 +291,9 @@ bool waitForClientConnect(const HANDLE pipe, const HANDLE event, const HANDLE pr | |||
| return true; | |||
| case ERROR_PIPE_LISTENING: | |||
| if (carla_gettime_ms() < timeoutEnd) | |||
| if (d_gettime_ms() < timeoutEnd) | |||
| { | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| continue; | |||
| } | |||
| carla_stderr2("ConnectNamedPipe listening timed out"); | |||
| @@ -368,7 +356,7 @@ bool waitForClientFirstMessage(const P& pipe, void* const ovRecv, void* const pr | |||
| char c; | |||
| ssize_t ret; | |||
| const uint32_t timeoutEnd = carla_gettime_ms() + timeOutMilliseconds; | |||
| const uint32_t timeoutEnd = d_gettime_ms() + timeOutMilliseconds; | |||
| #ifdef CARLA_OS_WIN | |||
| if (! waitForClientConnect(pipe, (HANDLE)ovRecv, (HANDLE)process, timeOutMilliseconds)) | |||
| @@ -401,9 +389,9 @@ bool waitForClientFirstMessage(const P& pipe, void* const ovRecv, void* const pr | |||
| if (errno == EAGAIN) | |||
| #endif | |||
| { | |||
| if (carla_gettime_ms() < timeoutEnd) | |||
| if (d_gettime_ms() < timeoutEnd) | |||
| { | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| continue; | |||
| } | |||
| carla_stderr("waitForClientFirstMessage() - read timed out"); | |||
| @@ -439,7 +427,7 @@ bool waitForProcessToStop(const HANDLE process, const uint32_t timeOutMillisecon | |||
| CARLA_SAFE_ASSERT_RETURN(process != INVALID_HANDLE_VALUE, false); | |||
| CARLA_SAFE_ASSERT_RETURN(timeOutMilliseconds > 0, false); | |||
| const uint32_t timeoutEnd = carla_gettime_ms() + timeOutMilliseconds; | |||
| const uint32_t timeoutEnd = d_gettime_ms() + timeOutMilliseconds; | |||
| for (;;) | |||
| { | |||
| @@ -456,10 +444,10 @@ bool waitForProcessToStop(const HANDLE process, const uint32_t timeOutMillisecon | |||
| ::TerminateProcess(process, 15); | |||
| } | |||
| if (carla_gettime_ms() >= timeoutEnd) | |||
| if (d_gettime_ms() >= timeoutEnd) | |||
| break; | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| } | |||
| return false; | |||
| @@ -490,7 +478,7 @@ bool waitForChildToStop(const pid_t pid, const uint32_t timeOutMilliseconds, boo | |||
| CARLA_SAFE_ASSERT_RETURN(timeOutMilliseconds > 0, false); | |||
| pid_t ret; | |||
| const uint32_t timeoutEnd = carla_gettime_ms() + timeOutMilliseconds; | |||
| const uint32_t timeoutEnd = d_gettime_ms() + timeOutMilliseconds; | |||
| for (;;) | |||
| { | |||
| @@ -520,9 +508,9 @@ bool waitForChildToStop(const pid_t pid, const uint32_t timeOutMilliseconds, boo | |||
| sendTerminate = false; | |||
| ::kill(pid, SIGTERM); | |||
| } | |||
| if (carla_gettime_ms() < timeoutEnd) | |||
| if (d_gettime_ms() < timeoutEnd) | |||
| { | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| continue; | |||
| } | |||
| carla_stderr("waitForChildToStop() - timed out"); | |||
| @@ -1377,7 +1365,7 @@ const char* CarlaPipeCommon::_readlineblock(const bool allocReturn, | |||
| const uint16_t size, | |||
| const uint32_t timeOutMilliseconds) const noexcept | |||
| { | |||
| const uint32_t timeoutEnd = carla_gettime_ms() + timeOutMilliseconds; | |||
| const uint32_t timeoutEnd = d_gettime_ms() + timeOutMilliseconds; | |||
| bool readSucess; | |||
| for (;;) | |||
| @@ -1388,17 +1376,17 @@ const char* CarlaPipeCommon::_readlineblock(const bool allocReturn, | |||
| if (readSucess) | |||
| return msg; | |||
| if (carla_gettime_ms() >= timeoutEnd) | |||
| if (d_gettime_ms() >= timeoutEnd) | |||
| break; | |||
| carla_msleep(5); | |||
| d_msleep(5); | |||
| } | |||
| static const bool testingForValgrind = std::getenv("CARLA_VALGRIND_TEST") != nullptr; | |||
| if (testingForValgrind) | |||
| { | |||
| const uint32_t timeoutEnd2 = carla_gettime_ms() + 1000; | |||
| const uint32_t timeoutEnd2 = d_gettime_ms() + 1000; | |||
| for (;;) | |||
| { | |||
| @@ -1408,10 +1396,10 @@ const char* CarlaPipeCommon::_readlineblock(const bool allocReturn, | |||
| if (readSucess) | |||
| return msg; | |||
| if (carla_gettime_ms() >= timeoutEnd2) | |||
| if (d_gettime_ms() >= timeoutEnd2) | |||
| break; | |||
| carla_msleep(100); | |||
| d_msleep(100); | |||
| } | |||
| } | |||
| @@ -1997,7 +1985,7 @@ void CarlaPipeClient::writeExitingMessageAndWait() noexcept | |||
| for (int i=0; i < 100 && ! pData->pipeClosed; ++i) | |||
| { | |||
| carla_msleep(50); | |||
| d_msleep(50); | |||
| idlePipe(true); | |||
| } | |||
| @@ -1,18 +1,5 @@ | |||
| /* | |||
| * Carla Runner | |||
| * Copyright (C) 2022-2023 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| * permission notice appear in all copies. | |||
| * | |||
| * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD | |||
| * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN | |||
| * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |||
| * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER | |||
| * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |||
| * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #ifndef CARLA_RUNNER_HPP_INCLUDED | |||
| #define CARLA_RUNNER_HPP_INCLUDED | |||
| @@ -191,7 +178,7 @@ private: | |||
| if (stillRunning && !shouldThreadExit()) | |||
| { | |||
| if (timeInterval != 0) | |||
| carla_msleep(timeInterval); | |||
| d_msleep(timeInterval); | |||
| // FIXME | |||
| // pthread_yield(); | |||
| @@ -1,19 +1,5 @@ | |||
| /* | |||
| * Carla Thread | |||
| * Copyright (C) 2013-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 2 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 doc/GPL.txt file. | |||
| */ | |||
| // SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com> | |||
| // SPDX-License-Identifier: GPL-2.0-or-later | |||
| #ifndef CARLA_THREAD_HPP_INCLUDED | |||
| #define CARLA_THREAD_HPP_INCLUDED | |||
| @@ -21,12 +7,14 @@ | |||
| #include "CarlaMutex.hpp" | |||
| #include "CarlaString.hpp" | |||
| #include "CarlaProcessUtils.hpp" | |||
| #include "CarlaTimeUtils.hpp" | |||
| #include "distrho/extra/Sleep.hpp" | |||
| #ifdef CARLA_OS_WASM | |||
| # error Threads do not work under wasm! | |||
| #endif | |||
| using DISTRHO_NAMESPACE::d_msleep; | |||
| // ----------------------------------------------------------------------- | |||
| // CarlaThread class | |||
| @@ -181,7 +169,7 @@ public: | |||
| for (; isThreadRunning();) | |||
| { | |||
| carla_msleep(2); | |||
| d_msleep(2); | |||
| if (timeOutCheck < 0) | |||
| continue; | |||