diff --git a/source/backend/engine/CarlaEngineBridge.cpp b/source/backend/engine/CarlaEngineBridge.cpp index 01dc3ff4d..bbb655317 100644 --- a/source/backend/engine/CarlaEngineBridge.cpp +++ b/source/backend/engine/CarlaEngineBridge.cpp @@ -32,6 +32,7 @@ #include "CarlaBackendUtils.hpp" #include "CarlaBase64Utils.hpp" #include "CarlaBridgeUtils.hpp" +#include "CarlaTimeUtils.hpp" #include "CarlaMIDI.h" #ifdef __SSE2_MATH__ @@ -47,7 +48,6 @@ using water::File; using water::MemoryBlock; using water::String; -using water::Time; CARLA_BACKEND_START_NAMESPACE @@ -382,7 +382,7 @@ public: if (wasFirstIdle) { fFirstIdle = false; - fLastPingTime = Time::currentTimeMillis(); + fLastPingTime = carla_gettime_ms(); CARLA_SAFE_ASSERT(fLastPingTime > 0); char bufStr[STR_MAX+1]; @@ -658,7 +658,7 @@ public: fShmNonRtServerControl.waitIfDataIsReachingLimit(); carla_stdout("Carla Bridge Ready!"); - fLastPingTime = Time::currentTimeMillis(); + fLastPingTime = carla_gettime_ms(); } // send parameter outputs @@ -687,7 +687,7 @@ public: handleNonRtData(); } CARLA_SAFE_EXCEPTION("handleNonRtData"); - if (fLastPingTime > 0 && Time::currentTimeMillis() > fLastPingTime + 30000 && ! wasFirstIdle) + if (fLastPingTime > 0 && carla_gettime_ms() > fLastPingTime + 30000 && ! wasFirstIdle) { carla_stderr("Did not receive ping message from server for 30 secs, closing..."); signalThreadShouldExit(); @@ -825,7 +825,7 @@ public: #endif if (opcode != kPluginBridgeNonRtClientNull && opcode != kPluginBridgeNonRtClientPingOnOff && fLastPingTime > 0) - fLastPingTime = Time::currentTimeMillis(); + fLastPingTime = carla_gettime_ms(); switch (opcode) { @@ -848,7 +848,7 @@ public: case kPluginBridgeNonRtClientPingOnOff: { const uint32_t onOff(fShmNonRtClientControl.readBool()); - fLastPingTime = onOff ? Time::currentTimeMillis() : -1; + fLastPingTime = onOff ? carla_gettime_ms() : -1; } break; case kPluginBridgeNonRtClientActivate: diff --git a/source/backend/plugin/CarlaPluginBridge.cpp b/source/backend/plugin/CarlaPluginBridge.cpp index 160d45dfd..bc1dc99f8 100644 --- a/source/backend/plugin/CarlaPluginBridge.cpp +++ b/source/backend/plugin/CarlaPluginBridge.cpp @@ -25,6 +25,7 @@ #include "CarlaPipeUtils.hpp" #include "CarlaScopeUtils.hpp" #include "CarlaShmUtils.hpp" +#include "CarlaTimeUtils.hpp" #include "CarlaThread.hpp" #include "jackbridge/JackBridge.hpp" @@ -41,7 +42,6 @@ using water::ChildProcess; using water::File; using water::String; using water::StringArray; -using water::Time; CARLA_BACKEND_START_NAMESPACE @@ -688,10 +688,10 @@ public: if (fReceivingParamText.wasDataReceived(&success)) return success; - const uint32_t timeoutEnd = Time::getMillisecondCounter() + 500; // 500 ms + const uint32_t timeoutEnd = carla_gettime_ms() + 500; // 500 ms const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin; - for (; Time::getMillisecondCounter() < timeoutEnd && fBridgeThread.isThreadRunning();) + for (; carla_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) { if (fReceivingParamText.wasDataReceived(&success)) return success; @@ -718,10 +718,10 @@ public: return; // TODO: only wait 1 minute for NI plugins - const uint32_t timeoutEnd = Time::getMillisecondCounter() + 60*1000; // 60 secs, 1 minute + const uint32_t timeoutEnd = carla_gettime_ms() + 60*1000; // 60 secs, 1 minute const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin; - for (; Time::getMillisecondCounter() < timeoutEnd && fBridgeThread.isThreadRunning();) + for (; carla_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) { pData->engine->callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); @@ -1114,10 +1114,10 @@ public: fShmNonRtClientControl.commitWrite(); } - const uint32_t timeoutEnd = Time::getMillisecondCounter() + 15*1000; // 15 secs + const uint32_t timeoutEnd = carla_gettime_ms() + 15*1000; // 15 secs const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin; - for (; Time::getMillisecondCounter() < timeoutEnd && fBridgeThread.isThreadRunning();) + for (; carla_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();) { pData->engine->callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); diff --git a/source/backend/plugin/CarlaPluginJack.cpp b/source/backend/plugin/CarlaPluginJack.cpp index d7f14c3d7..5be129163 100644 --- a/source/backend/plugin/CarlaPluginJack.cpp +++ b/source/backend/plugin/CarlaPluginJack.cpp @@ -52,7 +52,6 @@ using water::ChildProcess; using water::File; using water::String; using water::StringArray; -using water::Time; CARLA_BACKEND_START_NAMESPACE