diff --git a/resources/ui/carla_settings.ui b/resources/ui/carla_settings.ui index b66ad4273..d30cd91ed 100644 --- a/resources/ui/carla_settings.ui +++ b/resources/ui/carla_settings.ui @@ -741,6 +741,11 @@ Continuous Rack + + + Patchbay (EXPERIMENTAL) + + @@ -757,7 +762,12 @@ - Continuous Rack (EXPERIMENTAL) + Continuous Rack + + + + + Patchbay (EXPERIMENTAL) diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 5040f9dc2..c28a81217 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -594,7 +594,7 @@ bool CarlaEngine::removePlugin(const uint id) pData->thread.stopThread(500); #ifndef BUILD_BRIDGE - const bool lockWait(isRunning() && pData->options.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS); + const bool lockWait(isRunning() /*&& pData->options.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS*/); const ScopedActionLock sal(pData, kEnginePostActionRemovePlugin, id, 0, lockWait); for (uint i=id; i < pData->curPluginCount; ++i) @@ -604,6 +604,9 @@ bool CarlaEngine::removePlugin(const uint id) plugin2->updateOscURL(); } + if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) + pData->graph.removePlugin(plugin); + if (isOscControlRegistered()) oscSend_control_remove_plugin(id); #else @@ -611,9 +614,6 @@ bool CarlaEngine::removePlugin(const uint id) carla_zeroStruct(pData->plugins, 1); #endif - if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) - pData->graph.removePlugin(plugin); - delete plugin; if (isRunning() && ! pData->aboutToClose) @@ -777,7 +777,7 @@ bool CarlaEngine::switchPlugins(const uint idA, const uint idB) noexcept pData->thread.stopThread(500); - const bool lockWait(isRunning() && pData->options.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS); + const bool lockWait(isRunning() /*&& pData->options.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS*/); const ScopedActionLock sal(pData, kEnginePostActionSwitchPlugins, idA, idB, lockWait); CarlaPlugin* const pluginA(pData->plugins[idA].plugin); diff --git a/source/backend/engine/CarlaEngineGraph.cpp b/source/backend/engine/CarlaEngineGraph.cpp index 7b34a377a..f3880b670 100644 --- a/source/backend/engine/CarlaEngineGraph.cpp +++ b/source/backend/engine/CarlaEngineGraph.cpp @@ -940,6 +940,9 @@ public: if (const int numChan = audio.getNumChannels()) { + if (fPlugin->getAudioInCount() == 0) + audio.clear(); + float* audioBuffers[numChan]; for (int i=0; igetDefaultEventOutPort()) { - const EngineEvent* const engineEvents(port->fBuffer); + /*const*/ EngineEvent* const engineEvents(port->fBuffer); CARLA_SAFE_ASSERT_RETURN(engineEvents != nullptr,); fillJuceMidiBufferFromEngineEvents(midi, engineEvents); + carla_zeroStruct(engineEvents, kMaxEngineEventInternalCount); } } @@ -1175,10 +1179,8 @@ void PatchbayGraph::removePlugin(CarlaPlugin* const plugin) // TODO //removePluginFromPatchbay(plugin); - graph.removeNode(plugin->getPatchbayNodeId()); - // Fix plugin Ids properties - for (uint i=plugin->getId(), count=engine->getCurrentPluginCount(); igetCurrentPluginCount(); igetPlugin(i)); CARLA_SAFE_ASSERT_BREAK(plugin2 != nullptr); @@ -1189,6 +1191,8 @@ void PatchbayGraph::removePlugin(CarlaPlugin* const plugin) node->properties.set("pluginId", static_cast(plugin2->getId())); } } + + CARLA_SAFE_ASSERT_RETURN(graph.removeNode(plugin->getPatchbayNodeId()),); } void PatchbayGraph::removeAllPlugins() diff --git a/source/backend/engine/CarlaEngineInternal.cpp b/source/backend/engine/CarlaEngineInternal.cpp index 39d2e2cef..b311a0808 100644 --- a/source/backend/engine/CarlaEngineInternal.cpp +++ b/source/backend/engine/CarlaEngineInternal.cpp @@ -331,9 +331,12 @@ void CarlaEngine::ProtectedData::doNextPluginAction(const bool unlock) noexcept ScopedActionLock::ScopedActionLock(CarlaEngine::ProtectedData* const data, const EnginePostAction action, const uint pluginId, const uint value, const bool lockWait) noexcept : fData(data) { - CARLA_SAFE_ASSERT_RETURN(fData->nextAction.opcode == kEnginePostActionNull,); CARLA_SAFE_ASSERT_RETURN(action != kEnginePostActionNull,); + fData->nextAction.mutex.lock(); + + CARLA_SAFE_ASSERT_RETURN(fData->nextAction.opcode == kEnginePostActionNull,); + fData->nextAction.opcode = action; fData->nextAction.pluginId = pluginId; fData->nextAction.value = value; @@ -353,6 +356,7 @@ ScopedActionLock::ScopedActionLock(CarlaEngine::ProtectedData* const data, const ScopedActionLock::~ScopedActionLock() noexcept { + CARLA_SAFE_ASSERT(fData->nextAction.opcode == kEnginePostActionNull); fData->nextAction.mutex.unlock(); }