Signed-off-by: falkTX <falktx@falktx.com>tags/v2.5.0
| @@ -22,10 +22,11 @@ | |||||
| #include "CarlaUtils.h" | #include "CarlaUtils.h" | ||||
| #include "CarlaEngine.hpp" | #include "CarlaEngine.hpp" | ||||
| #ifdef BUILD_BRIDGE | |||||
| # include "CarlaString.hpp" | |||||
| #else | |||||
| #if !(defined(BUILD_BRIDGE) || defined(CARLA_OS_WASM)) | |||||
| # define CARLA_CAN_USE_LOG_THREAD | |||||
| # include "CarlaLogThread.hpp" | # include "CarlaLogThread.hpp" | ||||
| #else | |||||
| # include "CarlaString.hpp" | |||||
| #endif | #endif | ||||
| namespace CB = CARLA_BACKEND_NAMESPACE; | namespace CB = CARLA_BACKEND_NAMESPACE; | ||||
| @@ -58,7 +59,7 @@ struct CarlaHostStandalone : CarlaHostHandleImpl { | |||||
| void* fileCallbackPtr; | void* fileCallbackPtr; | ||||
| EngineOptions engineOptions; | EngineOptions engineOptions; | ||||
| #ifndef BUILD_BRIDGE | |||||
| #ifdef CARLA_CAN_USE_LOG_THREAD | |||||
| CarlaLogThread logThread; | CarlaLogThread logThread; | ||||
| bool logThreadEnabled; | bool logThreadEnabled; | ||||
| #endif | #endif | ||||
| @@ -72,7 +73,7 @@ struct CarlaHostStandalone : CarlaHostHandleImpl { | |||||
| fileCallback(nullptr), | fileCallback(nullptr), | ||||
| fileCallbackPtr(nullptr), | fileCallbackPtr(nullptr), | ||||
| engineOptions(), | engineOptions(), | ||||
| #ifndef BUILD_BRIDGE | |||||
| #ifdef CARLA_CAN_USE_LOG_THREAD | |||||
| logThread(), | logThread(), | ||||
| logThreadEnabled(false), | logThreadEnabled(false), | ||||
| #endif | #endif | ||||
| @@ -28,11 +28,6 @@ | |||||
| #include "CarlaBase64Utils.hpp" | #include "CarlaBase64Utils.hpp" | ||||
| #include "ThreadSafeFFTW.hpp" | #include "ThreadSafeFFTW.hpp" | ||||
| #if !(defined(BUILD_BRIDGE) || defined(CARLA_OS_WASM)) | |||||
| # define CARLA_CAN_USE_LOG_THREAD | |||||
| # include "CarlaLogThread.hpp" | |||||
| #endif | |||||
| #include "water/files/File.h" | #include "water/files/File.h" | ||||
| #ifdef USING_JUCE | #ifdef USING_JUCE | ||||
| @@ -307,7 +307,7 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName) | |||||
| return newJack(); | return newJack(); | ||||
| #endif | #endif | ||||
| #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||||
| #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_OS_WASM)) | |||||
| if (std::strcmp(driverName, "Dummy") == 0) | if (std::strcmp(driverName, "Dummy") == 0) | ||||
| return newDummy(); | return newDummy(); | ||||
| #endif | #endif | ||||
| @@ -75,7 +75,7 @@ public: | |||||
| pData->graph.create(2, 2, 0, 0); | pData->graph.create(2, 2, 0, 0); | ||||
| if (! startThread(true)) | |||||
| if (! startThread()) | |||||
| { | { | ||||
| close(); | close(); | ||||
| setLastError("Failed to start dummy audio thread"); | setLastError("Failed to start dummy audio thread"); | ||||
| @@ -1694,7 +1694,7 @@ private: | |||||
| PatchbayGraph::PatchbayGraph(CarlaEngine* const engine, | PatchbayGraph::PatchbayGraph(CarlaEngine* const engine, | ||||
| const uint32_t audioIns, const uint32_t audioOuts, | const uint32_t audioIns, const uint32_t audioOuts, | ||||
| const uint32_t cvIns, const uint32_t cvOuts) | const uint32_t cvIns, const uint32_t cvOuts) | ||||
| : CarlaThread("PatchbayReorderThread"), | |||||
| : CarlaRunner("PatchbayReorderRunner"), | |||||
| connections(), | connections(), | ||||
| graph(), | graph(), | ||||
| audioBuffer(), | audioBuffer(), | ||||
| @@ -1826,12 +1826,12 @@ PatchbayGraph::PatchbayGraph(CarlaEngine* const engine, | |||||
| node->properties.set("isOSC", false); | node->properties.set("isOSC", false); | ||||
| } | } | ||||
| startThread(); | |||||
| startRunner(100); | |||||
| } | } | ||||
| PatchbayGraph::~PatchbayGraph() | PatchbayGraph::~PatchbayGraph() | ||||
| { | { | ||||
| stopThread(-1); | |||||
| stopRunner(); | |||||
| connections.clear(); | connections.clear(); | ||||
| extGraph.clear(); | extGraph.clear(); | ||||
| @@ -2578,13 +2578,10 @@ void PatchbayGraph::process(CarlaEngine::ProtectedData* const data, | |||||
| } | } | ||||
| } | } | ||||
| void PatchbayGraph::run() | |||||
| bool PatchbayGraph::run() | |||||
| { | { | ||||
| while (! shouldThreadExit()) | |||||
| { | |||||
| carla_msleep(100); | |||||
| graph.reorderNowIfNeeded(); | |||||
| } | |||||
| graph.reorderNowIfNeeded(); | |||||
| return true; | |||||
| } | } | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -22,7 +22,7 @@ | |||||
| #include "CarlaMutex.hpp" | #include "CarlaMutex.hpp" | ||||
| #include "CarlaPatchbayUtils.hpp" | #include "CarlaPatchbayUtils.hpp" | ||||
| #include "CarlaStringList.hpp" | #include "CarlaStringList.hpp" | ||||
| #include "CarlaThread.hpp" | |||||
| #include "CarlaRunner.hpp" | |||||
| #include "water/processors/AudioProcessorGraph.h" | #include "water/processors/AudioProcessorGraph.h" | ||||
| #include "water/text/StringArray.h" | #include "water/text/StringArray.h" | ||||
| @@ -163,7 +163,7 @@ struct RackGraph { | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // PatchbayGraph | // PatchbayGraph | ||||
| class PatchbayGraph : private CarlaThread { | |||||
| class PatchbayGraph : private CarlaRunner { | |||||
| public: | public: | ||||
| PatchbayConnectionList connections; | PatchbayConnectionList connections; | ||||
| AudioProcessorGraph graph; | AudioProcessorGraph graph; | ||||
| @@ -216,7 +216,7 @@ public: | |||||
| uint32_t frames); | uint32_t frames); | ||||
| private: | private: | ||||
| void run() override; | |||||
| bool run() override; | |||||
| CarlaEngine* const kEngine; | CarlaEngine* const kEngine; | ||||
| CARLA_DECLARE_NON_COPYABLE(PatchbayGraph) | CARLA_DECLARE_NON_COPYABLE(PatchbayGraph) | ||||
| @@ -769,25 +769,24 @@ ScopedActionLock::ScopedActionLock(CarlaEngine* const engine, | |||||
| if (pData->nextAction.needsPost) | if (pData->nextAction.needsPost) | ||||
| { | { | ||||
| bool engineStoppedWhileWaiting = false; | |||||
| #ifndef CARLA_OS_WASM | |||||
| #if defined(DEBUG) || defined(BUILD_BRIDGE) | #if defined(DEBUG) || defined(BUILD_BRIDGE) | ||||
| // block wait for unlock on processing side | // block wait for unlock on processing side | ||||
| carla_stdout(ACTION_MSG_PREFIX "ScopedPluginAction(%i) - blocking START", pluginId); | carla_stdout(ACTION_MSG_PREFIX "ScopedPluginAction(%i) - blocking START", pluginId); | ||||
| #endif | #endif | ||||
| bool engineStoppedWhileWaiting = false; | |||||
| if (! pData->nextAction.postDone) | if (! pData->nextAction.postDone) | ||||
| { | { | ||||
| for (int i = 10; --i >= 0;) | for (int i = 10; --i >= 0;) | ||||
| { | { | ||||
| #ifndef CARLA_OS_WASM | |||||
| if (pData->nextAction.sem != nullptr) | if (pData->nextAction.sem != nullptr) | ||||
| { | { | ||||
| if (carla_sem_timedwait(*pData->nextAction.sem, 200)) | if (carla_sem_timedwait(*pData->nextAction.sem, 200)) | ||||
| break; | break; | ||||
| } | } | ||||
| else | else | ||||
| #endif | |||||
| { | { | ||||
| carla_msleep(200); | carla_msleep(200); | ||||
| } | } | ||||
| @@ -803,6 +802,7 @@ ScopedActionLock::ScopedActionLock(CarlaEngine* const engine, | |||||
| #if defined(DEBUG) || defined(BUILD_BRIDGE) | #if defined(DEBUG) || defined(BUILD_BRIDGE) | ||||
| carla_stdout(ACTION_MSG_PREFIX "ScopedPluginAction(%i) - blocking DONE", pluginId); | carla_stdout(ACTION_MSG_PREFIX "ScopedPluginAction(%i) - blocking DONE", pluginId); | ||||
| #endif | #endif | ||||
| #endif | |||||
| // check if anything went wrong... | // check if anything went wrong... | ||||
| if (! pData->nextAction.postDone) | if (! pData->nextAction.postDone) | ||||
| @@ -34,12 +34,16 @@ OBJS = \ | |||||
| $(OBJDIR)/CarlaEngine.cpp.o \ | $(OBJDIR)/CarlaEngine.cpp.o \ | ||||
| $(OBJDIR)/CarlaEngineClient.cpp.o \ | $(OBJDIR)/CarlaEngineClient.cpp.o \ | ||||
| $(OBJDIR)/CarlaEngineData.cpp.o \ | $(OBJDIR)/CarlaEngineData.cpp.o \ | ||||
| $(OBJDIR)/CarlaEngineDummy.cpp.o \ | |||||
| $(OBJDIR)/CarlaEngineGraph.cpp.o \ | $(OBJDIR)/CarlaEngineGraph.cpp.o \ | ||||
| $(OBJDIR)/CarlaEngineInternal.cpp.o \ | $(OBJDIR)/CarlaEngineInternal.cpp.o \ | ||||
| $(OBJDIR)/CarlaEnginePorts.cpp.o \ | $(OBJDIR)/CarlaEnginePorts.cpp.o \ | ||||
| $(OBJDIR)/CarlaEngineRunner.cpp.o | $(OBJDIR)/CarlaEngineRunner.cpp.o | ||||
| ifneq ($(WASM),true) | |||||
| OBJS += \ | |||||
| $(OBJDIR)/CarlaEngineDummy.cpp.o | |||||
| endif | |||||
| ifeq ($(HAVE_LIBLO),true) | ifeq ($(HAVE_LIBLO),true) | ||||
| OBJS += \ | OBJS += \ | ||||
| $(OBJDIR)/CarlaEngineOsc.cpp.o \ | $(OBJDIR)/CarlaEngineOsc.cpp.o \ | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * Carla Plugin Host | * Carla Plugin Host | ||||
| * Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -17,7 +17,9 @@ | |||||
| #include "CarlaUtils.h" | #include "CarlaUtils.h" | ||||
| #include "CarlaThread.hpp" | |||||
| #ifndef CARLA_OS_WASM | |||||
| # include "CarlaThread.hpp" | |||||
| #endif | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -35,7 +37,9 @@ void carla_set_process_name(const char* name) | |||||
| { | { | ||||
| carla_debug("carla_set_process_name(\"%s\")", name); | carla_debug("carla_set_process_name(\"%s\")", name); | ||||
| #ifndef CARLA_OS_WASM | |||||
| CarlaThread::setCurrentThreadName(name); | CarlaThread::setCurrentThreadName(name); | ||||
| #endif | |||||
| } | } | ||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -13,8 +13,6 @@ | |||||
| #include "water/synthesisers/Synthesiser.h" | #include "water/synthesisers/Synthesiser.h" | ||||
| #include "water/text/StringArray.h" | #include "water/text/StringArray.h" | ||||
| #include "CarlaThread.hpp" | |||||
| namespace sfzero | namespace sfzero | ||||
| { | { | ||||