@@ -171,7 +171,10 @@ public: | |||
PluginBridgeNonRtClientOpcode opcode; | |||
opcode = fShmNonRtClientControl.readOpcode(); | |||
CARLA_SAFE_ASSERT_INT(opcode == kPluginBridgeNonRtClientNull, opcode); | |||
CARLA_SAFE_ASSERT_RETURN(opcode == kPluginBridgeNonRtClientVersion, false); | |||
const uint32_t apiVersion = fShmNonRtClientControl.readUInt(); | |||
CARLA_SAFE_ASSERT_RETURN(apiVersion == CARLA_PLUGIN_BRIDGE_API_VERSION, false); | |||
const uint32_t shmRtClientDataSize = fShmNonRtClientControl.readUInt(); | |||
CARLA_SAFE_ASSERT_INT2(shmRtClientDataSize == sizeof(BridgeRtClientData), shmRtClientDataSize, sizeof(BridgeRtClientData)); | |||
@@ -182,8 +185,17 @@ public: | |||
const uint32_t shmNonRtServerDataSize = fShmNonRtClientControl.readUInt(); | |||
CARLA_SAFE_ASSERT_INT2(shmNonRtServerDataSize == sizeof(BridgeNonRtServerData), shmNonRtServerDataSize, sizeof(BridgeNonRtServerData)); | |||
if (shmRtClientDataSize != sizeof(BridgeRtClientData) || | |||
shmNonRtClientDataSize != sizeof(BridgeNonRtClientData) || | |||
shmNonRtServerDataSize != sizeof(BridgeNonRtServerData)) | |||
{ | |||
carla_stderr2("CarlaJackAppClient: data size mismatch"); | |||
return false; | |||
} | |||
opcode = fShmNonRtClientControl.readOpcode(); | |||
CARLA_SAFE_ASSERT_INT(opcode == kPluginBridgeNonRtClientInitialSetup, opcode); | |||
CARLA_SAFE_ASSERT_RETURN(opcode == kPluginBridgeNonRtClientInitialSetup, false); | |||
pData->bufferSize = fShmNonRtClientControl.readUInt(); | |||
pData->sampleRate = fShmNonRtClientControl.readDouble(); | |||
@@ -195,9 +207,6 @@ public: | |||
pData->initTime(nullptr); | |||
if (shmRtClientDataSize != sizeof(BridgeRtClientData) || shmNonRtClientDataSize != sizeof(BridgeNonRtClientData) || shmNonRtServerDataSize != sizeof(BridgeNonRtServerData)) | |||
return false; | |||
// tell backend we're live | |||
{ | |||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | |||
@@ -208,7 +217,6 @@ public: | |||
// TODO | |||
startThread(/*Thread::realtimeAudioPriority*/); | |||
return true; | |||
} | |||
@@ -661,6 +669,11 @@ public: | |||
case kPluginBridgeNonRtClientNull: | |||
break; | |||
case kPluginBridgeNonRtClientVersion: { | |||
const uint apiVersion = fShmNonRtServerControl.readUInt(); | |||
CARLA_SAFE_ASSERT_UINT2(apiVersion == CARLA_PLUGIN_BRIDGE_API_VERSION, apiVersion, CARLA_PLUGIN_BRIDGE_API_VERSION); | |||
} break; | |||
case kPluginBridgeNonRtClientPing: { | |||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | |||
@@ -2211,7 +2211,9 @@ public: | |||
// --------------------------------------------------------------- | |||
// initial values | |||
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientNull); | |||
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientVersion); | |||
fShmNonRtClientControl.writeUInt(CARLA_PLUGIN_BRIDGE_API_VERSION); | |||
fShmNonRtClientControl.writeUInt(static_cast<uint32_t>(sizeof(BridgeRtClientData))); | |||
fShmNonRtClientControl.writeUInt(static_cast<uint32_t>(sizeof(BridgeNonRtClientData))); | |||
fShmNonRtClientControl.writeUInt(static_cast<uint32_t>(sizeof(BridgeNonRtServerData))); | |||
@@ -1422,7 +1422,9 @@ private: | |||
fShmNonRtServerControl.clearData(); | |||
// initial values | |||
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientNull); | |||
fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientVersion); | |||
fShmNonRtClientControl.writeUInt(CARLA_PLUGIN_BRIDGE_API_VERSION); | |||
fShmNonRtClientControl.writeUInt(static_cast<uint32_t>(sizeof(BridgeRtClientData))); | |||
fShmNonRtClientControl.writeUInt(static_cast<uint32_t>(sizeof(BridgeNonRtClientData))); | |||
fShmNonRtClientControl.writeUInt(static_cast<uint32_t>(sizeof(BridgeNonRtServerData))); | |||
@@ -353,7 +353,10 @@ bool CarlaJackAppClient::initSharedMemmory() | |||
PluginBridgeNonRtClientOpcode opcode; | |||
opcode = fShmNonRtClientControl.readOpcode(); | |||
CARLA_SAFE_ASSERT_INT(opcode == kPluginBridgeNonRtClientNull, opcode); | |||
CARLA_SAFE_ASSERT_RETURN(opcode == kPluginBridgeNonRtClientVersion, false); | |||
const uint32_t apiVersion = fShmNonRtClientControl.readUInt(); | |||
CARLA_SAFE_ASSERT_RETURN(apiVersion == CARLA_PLUGIN_BRIDGE_API_VERSION, false); | |||
const uint32_t shmRtClientDataSize = fShmNonRtClientControl.readUInt(); | |||
CARLA_SAFE_ASSERT_INT2(shmRtClientDataSize == sizeof(BridgeRtClientData), shmRtClientDataSize, sizeof(BridgeRtClientData)); | |||
@@ -364,14 +367,17 @@ bool CarlaJackAppClient::initSharedMemmory() | |||
const uint32_t shmNonRtServerDataSize = fShmNonRtClientControl.readUInt(); | |||
CARLA_SAFE_ASSERT_INT2(shmNonRtServerDataSize == sizeof(BridgeNonRtServerData), shmNonRtServerDataSize, sizeof(BridgeNonRtServerData)); | |||
if (shmRtClientDataSize != sizeof(BridgeRtClientData) || shmNonRtClientDataSize != sizeof(BridgeNonRtClientData) || shmNonRtServerDataSize != sizeof(BridgeNonRtServerData)) | |||
if (shmRtClientDataSize != sizeof(BridgeRtClientData) || | |||
shmNonRtClientDataSize != sizeof(BridgeNonRtClientData) || | |||
shmNonRtServerDataSize != sizeof(BridgeNonRtServerData)) | |||
{ | |||
carla_stderr2("CarlaJackAppClient: data size mismatch"); | |||
return false; | |||
} | |||
opcode = fShmNonRtClientControl.readOpcode(); | |||
CARLA_SAFE_ASSERT_INT(opcode == kPluginBridgeNonRtClientInitialSetup, opcode); | |||
CARLA_SAFE_ASSERT_RETURN(opcode == kPluginBridgeNonRtClientInitialSetup, false); | |||
fServer.bufferSize = fShmNonRtClientControl.readUInt(); | |||
fServer.sampleRate = fShmNonRtClientControl.readDouble(); | |||
@@ -869,6 +875,11 @@ bool CarlaJackAppClient::handleNonRtData() | |||
case kPluginBridgeNonRtClientNull: | |||
break; | |||
case kPluginBridgeNonRtClientVersion: { | |||
const uint apiVersion = fShmNonRtServerControl.readUInt(); | |||
CARLA_SAFE_ASSERT_UINT2(apiVersion == CARLA_PLUGIN_BRIDGE_API_VERSION, apiVersion, CARLA_PLUGIN_BRIDGE_API_VERSION); | |||
} break; | |||
case kPluginBridgeNonRtClientPing: { | |||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | |||
@@ -20,6 +20,8 @@ | |||
#include "CarlaRingBuffer.hpp" | |||
#define CARLA_PLUGIN_BRIDGE_API_VERSION 1 | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
// Server sends these to client during RT | |||
@@ -42,6 +44,7 @@ enum PluginBridgeRtClientOpcode { | |||
// Server sends these to client during non-RT | |||
enum PluginBridgeNonRtClientOpcode { | |||
kPluginBridgeNonRtClientNull = 0, | |||
kPluginBridgeNonRtClientVersion, // uint | |||
kPluginBridgeNonRtClientPing, | |||
kPluginBridgeNonRtClientPingOnOff, // bool | |||
kPluginBridgeNonRtClientActivate, | |||
@@ -78,6 +78,8 @@ const char* PluginBridgeNonRtClientOpcode2str(const PluginBridgeNonRtClientOpcod | |||
{ | |||
case kPluginBridgeNonRtClientNull: | |||
return "kPluginBridgeNonRtClientNull"; | |||
case kPluginBridgeNonRtClientVersion: | |||
return "kPluginBridgeNonRtClientVersion"; | |||
case kPluginBridgeNonRtClientPing: | |||
return "kPluginBridgeNonRtClientPing"; | |||
case kPluginBridgeNonRtClientPingOnOff: | |||