From 45287c55f153f37fc769d0bcc4e246bd7cd03cfa Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 25 Jun 2020 05:16:20 +0100 Subject: [PATCH] plugin-bridge: give host idle time while waiting for parameter text Signed-off-by: falkTX --- source/backend/plugin/CarlaPluginBridge.cpp | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/source/backend/plugin/CarlaPluginBridge.cpp b/source/backend/plugin/CarlaPluginBridge.cpp index ab897a380..19459e273 100644 --- a/source/backend/plugin/CarlaPluginBridge.cpp +++ b/source/backend/plugin/CarlaPluginBridge.cpp @@ -624,26 +624,27 @@ public: if (fReceivingParamText.wasDataReceived(&success)) return success; - const uint32_t timeoutEnd(Time::getMillisecondCounter() + 500); // 500 ms + const uint32_t timeoutEnd = Time::getMillisecondCounter() + 500; // 500 ms + const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin; for (; Time::getMillisecondCounter() < timeoutEnd && fBridgeThread.isThreadRunning();) { if (fReceivingParamText.wasDataReceived(&success)) return success; + if (needsEngineIdle) + pData->engine->idle(); + carla_msleep(5); } - carla_stderr("CarlaPluginBridge::waitForParameterText() - Timeout while requesting text"); - -#if 0 - // we waited and blocked for 5 secs, give host idle time now - pData->engine->callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); - - if (pData->engine->getType() != kEngineTypePlugin) - pData->engine->idle(); -#endif + if (! fBridgeThread.isThreadRunning()) + { + carla_stderr("CarlaPluginBridge::waitForParameterText() - Bridge is not running"); + return false; + } + carla_stderr("CarlaPluginBridge::waitForParameterText() - Timeout while requesting text"); return false; } @@ -653,8 +654,8 @@ public: return; // TODO: only wait 1 minute for NI plugins - const uint32_t timeoutEnd(Time::getMillisecondCounter() + 60*1000); // 60 secs, 1 minute - const bool needsEngineIdle(pData->engine->getType() != kEngineTypePlugin); + const uint32_t timeoutEnd = Time::getMillisecondCounter() + 60*1000; // 60 secs, 1 minute + const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin; for (; Time::getMillisecondCounter() < timeoutEnd && fBridgeThread.isThreadRunning();) {