Browse Source

libjack: fix for clients registering too early

tags/v2.1-alpha1-winvst
falkTX 6 years ago
parent
commit
2f4b09ac25
1 changed files with 15 additions and 7 deletions
  1. +15
    -7
      source/libjack/libjack.cpp

+ 15
- 7
source/libjack/libjack.cpp View File

@@ -120,6 +120,7 @@ public:
fMidiInBuffers(nullptr), fMidiInBuffers(nullptr),
fMidiOutBuffers(nullptr), fMidiOutBuffers(nullptr),
fIsOffline(false), fIsOffline(false),
fIsReady(false),
fLastPingTime(-1), fLastPingTime(-1),
fSessionManager(0), fSessionManager(0),
fSetupHints(0), fSetupHints(0),
@@ -194,6 +195,9 @@ public:


JackClientState* createClient(const char* const name) JackClientState* createClient(const char* const name)
{ {
while (fNonRealtimeThread.isThreadRunning() && ! fIsReady)
carla_sleep(1);

return new JackClientState(fServer, name); return new JackClientState(fServer, name);
} }


@@ -285,6 +289,7 @@ private:
char fBaseNameNonRtServerControl[6+1]; char fBaseNameNonRtServerControl[6+1];


bool fIsOffline; bool fIsOffline;
volatile bool fIsReady;
int64_t fLastPingTime; int64_t fLastPingTime;


int fSessionManager; int fSessionManager;
@@ -390,17 +395,20 @@ bool CarlaJackAppClient::initSharedMemmory()
fAudioTmpBuf = new float[fServer.bufferSize]; fAudioTmpBuf = new float[fServer.bufferSize];
carla_zeroFloats(fAudioTmpBuf, fServer.bufferSize); carla_zeroFloats(fAudioTmpBuf, fServer.bufferSize);


// tell backend we're live
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex);

fLastPingTime = getCurrentTimeMilliseconds(); fLastPingTime = getCurrentTimeMilliseconds();
CARLA_SAFE_ASSERT(fLastPingTime > 0); CARLA_SAFE_ASSERT(fLastPingTime > 0);


// ready!
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerReady);
fShmNonRtServerControl.commitWrite();
fShmNonRtServerControl.waitIfDataIsReachingLimit();
{
// tell backend we're live
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex);

// ready!
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerReady);
fShmNonRtServerControl.commitWrite();
fShmNonRtServerControl.waitIfDataIsReachingLimit();
}


fIsReady = true;
return true; return true;
} }




Loading…
Cancel
Save