From cd6a2fb3a4022b6eb39e05f724a1e9b8b6179911 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 19 Feb 2014 12:46:11 +0000 Subject: [PATCH] Use engine-callback-idle when performing long operations --- source/backend/engine/CarlaEngine.cpp | 8 ++++++++ source/backend/plugin/BridgePlugin.cpp | 1 + source/carla_host.py | 2 ++ 3 files changed, 11 insertions(+) diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 174d8568e..63e3c8b78 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1015,6 +1015,8 @@ bool CarlaEngine::removeAllPlugins() const bool lockWait(isRunning()); const CarlaEngineProtectedData::ScopedActionLock sal(pData, kEnginePostActionZeroCount, 0, 0, lockWait); + callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); + for (unsigned int i=0; i < pData->maxPluginNumber; ++i) { EnginePluginData& pluginData(pData->plugins[i]); @@ -1029,6 +1031,8 @@ bool CarlaEngine::removeAllPlugins() pluginData.insPeak[1] = 0.0f; pluginData.outsPeak[0] = 0.0f; pluginData.outsPeak[1] = 0.0f; + + callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); } if (isRunning() && ! pData->aboutToClose) @@ -1423,6 +1427,8 @@ bool CarlaEngine::loadProject(const char* const filename) SaveState saveState; fillSaveStateFromXmlNode(saveState, isPreset ? xmlNode : node); + callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); + CARLA_SAFE_ASSERT_CONTINUE(saveState.type != nullptr); const void* extraStuff = nullptr; @@ -1452,6 +1458,8 @@ bool CarlaEngine::loadProject(const char* const filename) } #ifndef BUILD_BRIDGE + callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); + // now connections for (QDomNode node = xmlNode.firstChild(); ! node.isNull(); node = node.nextSibling()) { diff --git a/source/backend/plugin/BridgePlugin.cpp b/source/backend/plugin/BridgePlugin.cpp index f1025411d..fa9a9cd91 100644 --- a/source/backend/plugin/BridgePlugin.cpp +++ b/source/backend/plugin/BridgePlugin.cpp @@ -1803,6 +1803,7 @@ public: if (fInitiated || ! pData->osc.thread.isRunning()) break; carla_msleep(50); + pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); } fLastPongCounter = -1; diff --git a/source/carla_host.py b/source/carla_host.py index 949aebe10..b8286e3e5 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -1226,6 +1226,8 @@ def engineCallback(ptr, action, pluginId, value1, value2, value3, valueStr): elif action == ENGINE_CALLBACK_ENGINE_STOPPED: gCarla.gui.killTimers() gCarla.gui.EngineStoppedCallback.emit() + elif action == ENGINE_CALLBACK_IDLE: + QApplication.instance().processEvents() elif action == ENGINE_CALLBACK_INFO: gCarla.gui.InfoCallback.emit(valueStr) elif action == ENGINE_CALLBACK_ERROR: