Browse Source

Use carla time utils in a few more places

Signed-off-by: falkTX <falktx@falktx.com>
pull/1780/head
falkTX 1 year ago
parent
commit
55ccf82c81
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 13 additions and 14 deletions
  1. +6
    -6
      source/backend/engine/CarlaEngineBridge.cpp
  2. +7
    -7
      source/backend/plugin/CarlaPluginBridge.cpp
  3. +0
    -1
      source/backend/plugin/CarlaPluginJack.cpp

+ 6
- 6
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -32,6 +32,7 @@
#include "CarlaBackendUtils.hpp" #include "CarlaBackendUtils.hpp"
#include "CarlaBase64Utils.hpp" #include "CarlaBase64Utils.hpp"
#include "CarlaBridgeUtils.hpp" #include "CarlaBridgeUtils.hpp"
#include "CarlaTimeUtils.hpp"
#include "CarlaMIDI.h" #include "CarlaMIDI.h"


#ifdef __SSE2_MATH__ #ifdef __SSE2_MATH__
@@ -47,7 +48,6 @@
using water::File; using water::File;
using water::MemoryBlock; using water::MemoryBlock;
using water::String; using water::String;
using water::Time;


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


@@ -382,7 +382,7 @@ public:
if (wasFirstIdle) if (wasFirstIdle)
{ {
fFirstIdle = false; fFirstIdle = false;
fLastPingTime = Time::currentTimeMillis();
fLastPingTime = carla_gettime_ms();
CARLA_SAFE_ASSERT(fLastPingTime > 0); CARLA_SAFE_ASSERT(fLastPingTime > 0);


char bufStr[STR_MAX+1]; char bufStr[STR_MAX+1];
@@ -658,7 +658,7 @@ public:
fShmNonRtServerControl.waitIfDataIsReachingLimit(); fShmNonRtServerControl.waitIfDataIsReachingLimit();


carla_stdout("Carla Bridge Ready!"); carla_stdout("Carla Bridge Ready!");
fLastPingTime = Time::currentTimeMillis();
fLastPingTime = carla_gettime_ms();
} }


// send parameter outputs // send parameter outputs
@@ -687,7 +687,7 @@ public:
handleNonRtData(); handleNonRtData();
} CARLA_SAFE_EXCEPTION("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..."); carla_stderr("Did not receive ping message from server for 30 secs, closing...");
signalThreadShouldExit(); signalThreadShouldExit();
@@ -825,7 +825,7 @@ public:
#endif #endif


if (opcode != kPluginBridgeNonRtClientNull && opcode != kPluginBridgeNonRtClientPingOnOff && fLastPingTime > 0) if (opcode != kPluginBridgeNonRtClientNull && opcode != kPluginBridgeNonRtClientPingOnOff && fLastPingTime > 0)
fLastPingTime = Time::currentTimeMillis();
fLastPingTime = carla_gettime_ms();


switch (opcode) switch (opcode)
{ {
@@ -848,7 +848,7 @@ public:
case kPluginBridgeNonRtClientPingOnOff: { case kPluginBridgeNonRtClientPingOnOff: {
const uint32_t onOff(fShmNonRtClientControl.readBool()); const uint32_t onOff(fShmNonRtClientControl.readBool());


fLastPingTime = onOff ? Time::currentTimeMillis() : -1;
fLastPingTime = onOff ? carla_gettime_ms() : -1;
} break; } break;


case kPluginBridgeNonRtClientActivate: case kPluginBridgeNonRtClientActivate:


+ 7
- 7
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -25,6 +25,7 @@
#include "CarlaPipeUtils.hpp" #include "CarlaPipeUtils.hpp"
#include "CarlaScopeUtils.hpp" #include "CarlaScopeUtils.hpp"
#include "CarlaShmUtils.hpp" #include "CarlaShmUtils.hpp"
#include "CarlaTimeUtils.hpp"
#include "CarlaThread.hpp" #include "CarlaThread.hpp"


#include "jackbridge/JackBridge.hpp" #include "jackbridge/JackBridge.hpp"
@@ -41,7 +42,6 @@ using water::ChildProcess;
using water::File; using water::File;
using water::String; using water::String;
using water::StringArray; using water::StringArray;
using water::Time;


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


@@ -688,10 +688,10 @@ public:
if (fReceivingParamText.wasDataReceived(&success)) if (fReceivingParamText.wasDataReceived(&success))
return 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; const bool needsEngineIdle = pData->engine->getType() != kEngineTypePlugin;


for (; Time::getMillisecondCounter() < timeoutEnd && fBridgeThread.isThreadRunning();)
for (; carla_gettime_ms() < timeoutEnd && fBridgeThread.isThreadRunning();)
{ {
if (fReceivingParamText.wasDataReceived(&success)) if (fReceivingParamText.wasDataReceived(&success))
return success; return success;
@@ -718,10 +718,10 @@ public:
return; return;


// TODO: only wait 1 minute for NI plugins // 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; 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); pData->engine->callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);


@@ -1114,10 +1114,10 @@ public:
fShmNonRtClientControl.commitWrite(); 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; 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); pData->engine->callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);




+ 0
- 1
source/backend/plugin/CarlaPluginJack.cpp View File

@@ -52,7 +52,6 @@ using water::ChildProcess;
using water::File; using water::File;
using water::String; using water::String;
using water::StringArray; using water::StringArray;
using water::Time;


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE




Loading…
Cancel
Save