@@ -1699,36 +1699,36 @@ bool CarlaEngine::patchbayConnect(const int portA, const int portB) | |||||
case RACK_PATCHBAY_PORT_AUDIO_IN1: | case RACK_PATCHBAY_PORT_AUDIO_IN1: | ||||
CARLA_SAFE_ASSERT_BREAK(targetPort >= RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | CARLA_SAFE_ASSERT_BREAK(targetPort >= RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | ||||
CARLA_SAFE_ASSERT_BREAK(targetPort <= RACK_PATCHBAY_GROUP_AUDIO_IN*1000+999); | CARLA_SAFE_ASSERT_BREAK(targetPort <= RACK_PATCHBAY_GROUP_AUDIO_IN*1000+999); | ||||
rack->connectLock.lock(); | |||||
rack->connectedIns[0].append(targetPort - RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | |||||
rack->connectLock.unlock(); | |||||
rack->connectLock.enter(); | |||||
rack->connectedIn1.append(targetPort - RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | |||||
rack->connectLock.leave(); | |||||
makeConnection = true; | makeConnection = true; | ||||
break; | break; | ||||
case RACK_PATCHBAY_PORT_AUDIO_IN2: | case RACK_PATCHBAY_PORT_AUDIO_IN2: | ||||
CARLA_SAFE_ASSERT_BREAK(targetPort >= RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | CARLA_SAFE_ASSERT_BREAK(targetPort >= RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | ||||
CARLA_SAFE_ASSERT_BREAK(targetPort <= RACK_PATCHBAY_GROUP_AUDIO_IN*1000+999); | CARLA_SAFE_ASSERT_BREAK(targetPort <= RACK_PATCHBAY_GROUP_AUDIO_IN*1000+999); | ||||
rack->connectLock.lock(); | |||||
rack->connectedIns[1].append(targetPort - RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | |||||
rack->connectLock.unlock(); | |||||
rack->connectLock.enter(); | |||||
rack->connectedIn2.append(targetPort - RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | |||||
rack->connectLock.leave(); | |||||
makeConnection = true; | makeConnection = true; | ||||
break; | break; | ||||
case RACK_PATCHBAY_PORT_AUDIO_OUT1: | case RACK_PATCHBAY_PORT_AUDIO_OUT1: | ||||
CARLA_SAFE_ASSERT_BREAK(targetPort >= RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | CARLA_SAFE_ASSERT_BREAK(targetPort >= RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | ||||
CARLA_SAFE_ASSERT_BREAK(targetPort <= RACK_PATCHBAY_GROUP_AUDIO_OUT*1000+999); | CARLA_SAFE_ASSERT_BREAK(targetPort <= RACK_PATCHBAY_GROUP_AUDIO_OUT*1000+999); | ||||
rack->connectLock.lock(); | |||||
rack->connectedOuts[0].append(targetPort - RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | |||||
rack->connectLock.unlock(); | |||||
rack->connectLock.enter(); | |||||
rack->connectedOut1.append(targetPort - RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | |||||
rack->connectLock.leave(); | |||||
makeConnection = true; | makeConnection = true; | ||||
break; | break; | ||||
case RACK_PATCHBAY_PORT_AUDIO_OUT2: | case RACK_PATCHBAY_PORT_AUDIO_OUT2: | ||||
CARLA_SAFE_ASSERT_BREAK(targetPort >= RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | CARLA_SAFE_ASSERT_BREAK(targetPort >= RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | ||||
CARLA_SAFE_ASSERT_BREAK(targetPort <= RACK_PATCHBAY_GROUP_AUDIO_OUT*1000+999); | CARLA_SAFE_ASSERT_BREAK(targetPort <= RACK_PATCHBAY_GROUP_AUDIO_OUT*1000+999); | ||||
rack->connectLock.lock(); | |||||
rack->connectedOuts[1].append(targetPort - RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | |||||
rack->connectLock.unlock(); | |||||
rack->connectLock.enter(); | |||||
rack->connectedOut2.append(targetPort - RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | |||||
rack->connectLock.leave(); | |||||
makeConnection = true; | makeConnection = true; | ||||
break; | break; | ||||
@@ -1810,14 +1810,14 @@ bool CarlaEngine::patchbayDisconnect(const uint connectionId) | |||||
const int portId(otherPort-RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | const int portId(otherPort-RACK_PATCHBAY_GROUP_AUDIO_OUT*1000); | ||||
rack->connectLock.lock(); | |||||
rack->connectLock.enter(); | |||||
if (carlaPort == RACK_PATCHBAY_PORT_AUDIO_OUT1) | if (carlaPort == RACK_PATCHBAY_PORT_AUDIO_OUT1) | ||||
rack->connectedOuts[0].removeAll(portId); | |||||
rack->connectedOut1.removeAll(portId); | |||||
else | else | ||||
rack->connectedOuts[1].removeAll(portId); | |||||
rack->connectedOut2.removeAll(portId); | |||||
rack->connectLock.unlock(); | |||||
rack->connectLock.leave(); | |||||
} | } | ||||
else if (otherPort >= RACK_PATCHBAY_GROUP_AUDIO_IN*1000) | else if (otherPort >= RACK_PATCHBAY_GROUP_AUDIO_IN*1000) | ||||
{ | { | ||||
@@ -1825,14 +1825,14 @@ bool CarlaEngine::patchbayDisconnect(const uint connectionId) | |||||
const int portId(otherPort-RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | const int portId(otherPort-RACK_PATCHBAY_GROUP_AUDIO_IN*1000); | ||||
rack->connectLock.lock(); | |||||
rack->connectLock.enter(); | |||||
if (carlaPort == RACK_PATCHBAY_PORT_AUDIO_IN1) | if (carlaPort == RACK_PATCHBAY_PORT_AUDIO_IN1) | ||||
rack->connectedIns[0].removeAll(portId); | |||||
rack->connectedIn1.removeAll(portId); | |||||
else | else | ||||
rack->connectedIns[1].removeAll(portId); | |||||
rack->connectedIn2.removeAll(portId); | |||||
rack->connectLock.unlock(); | |||||
rack->connectLock.leave(); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -323,10 +323,10 @@ void EngineRackBuffers::clear() | |||||
out[1] = nullptr; | out[1] = nullptr; | ||||
} | } | ||||
connectedIns[0].clear(); | |||||
connectedIns[1].clear(); | |||||
connectedOuts[0].clear(); | |||||
connectedOuts[1].clear(); | |||||
connectedIn1.clear(); | |||||
connectedIn2.clear(); | |||||
connectedOut1.clear(); | |||||
connectedOut2.clear(); | |||||
usedConnections.clear(); | usedConnections.clear(); | ||||
} | } | ||||
@@ -864,10 +864,10 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 | |||||
{ | { | ||||
EngineRackBuffers* const rack(bufAudio.rack); | EngineRackBuffers* const rack(bufAudio.rack); | ||||
const CarlaMutex::ScopedLocker sl(rack->connectLock); | |||||
const CarlaCriticalSection::Scope _cs2(rack->connectLock); | |||||
// connect input buffers | // connect input buffers | ||||
if (rack->connectedIns[0].count() == 0) | |||||
if (rack->connectedIn1.count() == 0) | |||||
{ | { | ||||
FLOAT_CLEAR(rack->in[0], nframes); | FLOAT_CLEAR(rack->in[0], nframes); | ||||
} | } | ||||
@@ -875,7 +875,7 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 | |||||
{ | { | ||||
bool first = true; | bool first = true; | ||||
for (LinkedList<int>::Itenerator it = rack->connectedIns[0].begin(); it.valid(); it.next()) | |||||
for (LinkedList<int>::Itenerator it = rack->connectedIn1.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const int& port(it.getValue()); | const int& port(it.getValue()); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(inCount)); | CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(inCount)); | ||||
@@ -895,7 +895,7 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 | |||||
FLOAT_CLEAR(rack->in[0], nframes); | FLOAT_CLEAR(rack->in[0], nframes); | ||||
} | } | ||||
if (rack->connectedIns[1].count() == 0) | |||||
if (rack->connectedIn2.count() == 0) | |||||
{ | { | ||||
FLOAT_CLEAR(rack->in[1], nframes); | FLOAT_CLEAR(rack->in[1], nframes); | ||||
} | } | ||||
@@ -903,7 +903,7 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 | |||||
{ | { | ||||
bool first = true; | bool first = true; | ||||
for (LinkedList<int>::Itenerator it = rack->connectedIns[1].begin(); it.valid(); it.next()) | |||||
for (LinkedList<int>::Itenerator it = rack->connectedIn2.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const int& port(it.getValue()); | const int& port(it.getValue()); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(inCount)); | CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(inCount)); | ||||
@@ -930,9 +930,9 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 | |||||
processRack(rack->in, rack->out, nframes, isOffline); | processRack(rack->in, rack->out, nframes, isOffline); | ||||
// connect output buffers | // connect output buffers | ||||
if (rack->connectedOuts[0].count() != 0) | |||||
if (rack->connectedOut1.count() != 0) | |||||
{ | { | ||||
for (LinkedList<int>::Itenerator it = rack->connectedOuts[0].begin(); it.valid(); it.next()) | |||||
for (LinkedList<int>::Itenerator it = rack->connectedOut1.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const int& port(it.getValue()); | const int& port(it.getValue()); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(outCount)); | CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(outCount)); | ||||
@@ -941,9 +941,9 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 | |||||
} | } | ||||
} | } | ||||
if (rack->connectedOuts[1].count() != 0) | |||||
if (rack->connectedOut2.count() != 0) | |||||
{ | { | ||||
for (LinkedList<int>::Itenerator it = rack->connectedOuts[1].begin(); it.valid(); it.next()) | |||||
for (LinkedList<int>::Itenerator it = rack->connectedOut2.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const int& port(it.getValue()); | const int& port(it.getValue()); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(outCount)); | CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(outCount)); | ||||
@@ -94,9 +94,11 @@ struct EngineRackBuffers { | |||||
float* out[2]; | float* out[2]; | ||||
// connections stuff | // connections stuff | ||||
LinkedList<int> connectedIns[2]; | |||||
LinkedList<int> connectedOuts[2]; | |||||
CarlaMutex connectLock; | |||||
LinkedList<int> connectedIn1; | |||||
LinkedList<int> connectedIn2; | |||||
LinkedList<int> connectedOut1; | |||||
LinkedList<int> connectedOut2; | |||||
CarlaCriticalSection connectLock; | |||||
uint lastConnectionId; | uint lastConnectionId; | ||||
LinkedList<ConnectionToId> usedConnections; | LinkedList<ConnectionToId> usedConnections; | ||||
@@ -500,9 +500,9 @@ public: | |||||
#endif | #endif | ||||
// Connections | // Connections | ||||
rack->connectLock.lock(); | |||||
rack->connectLock.enter(); | |||||
for (LinkedList<int>::Itenerator it = rack->connectedIns[0].begin(); it.valid(); it.next()) | |||||
for (LinkedList<int>::Itenerator it = rack->connectedIn1.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const int& port(it.getValue()); | const int& port(it.getValue()); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(pData->bufAudio.inCount)); | CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(pData->bufAudio.inCount)); | ||||
@@ -518,7 +518,7 @@ public: | |||||
rack->lastConnectionId++; | rack->lastConnectionId++; | ||||
} | } | ||||
for (LinkedList<int>::Itenerator it = rack->connectedIns[1].begin(); it.valid(); it.next()) | |||||
for (LinkedList<int>::Itenerator it = rack->connectedIn2.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const int& port(it.getValue()); | const int& port(it.getValue()); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(pData->bufAudio.inCount)); | CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(pData->bufAudio.inCount)); | ||||
@@ -534,7 +534,7 @@ public: | |||||
rack->lastConnectionId++; | rack->lastConnectionId++; | ||||
} | } | ||||
for (LinkedList<int>::Itenerator it = rack->connectedOuts[0].begin(); it.valid(); it.next()) | |||||
for (LinkedList<int>::Itenerator it = rack->connectedOut1.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const int& port(it.getValue()); | const int& port(it.getValue()); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(pData->bufAudio.outCount)); | CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(pData->bufAudio.outCount)); | ||||
@@ -550,7 +550,7 @@ public: | |||||
rack->lastConnectionId++; | rack->lastConnectionId++; | ||||
} | } | ||||
for (LinkedList<int>::Itenerator it = rack->connectedOuts[1].begin(); it.valid(); it.next()) | |||||
for (LinkedList<int>::Itenerator it = rack->connectedOut2.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const int& port(it.getValue()); | const int& port(it.getValue()); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(pData->bufAudio.outCount)); | CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast<int>(pData->bufAudio.outCount)); | ||||
@@ -566,7 +566,7 @@ public: | |||||
rack->lastConnectionId++; | rack->lastConnectionId++; | ||||
} | } | ||||
pData->bufAudio.rack->connectLock.unlock(); | |||||
pData->bufAudio.rack->connectLock.leave(); | |||||
for (LinkedList<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | for (LinkedList<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | ||||
{ | { | ||||
@@ -24,7 +24,8 @@ | |||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
static const char* PluginThreadMode2str(const CarlaPluginThread::Mode mode) | |||||
static inline | |||||
const char* PluginThreadMode2str(const CarlaPluginThread::Mode mode) | |||||
{ | { | ||||
switch (mode) | switch (mode) | ||||
{ | { | ||||
@@ -517,6 +517,7 @@ public: | |||||
clearBuffers(); | clearBuffers(); | ||||
uint32_t aIns, aOuts, mIns, mOuts, params; | uint32_t aIns, aOuts, mIns, mOuts, params; | ||||
aIns = aOuts = 0; | |||||
bool needsCtrlIn, needsCtrlOut; | bool needsCtrlIn, needsCtrlOut; | ||||
needsCtrlIn = needsCtrlOut = false; | needsCtrlIn = needsCtrlOut = false; | ||||
@@ -40,6 +40,10 @@ CarlaBridgeClient::CarlaBridgeClient(const char* const uiTitle) | |||||
CARLA_ASSERT(uiTitle != nullptr && uiTitle[0] != '\0'); | CARLA_ASSERT(uiTitle != nullptr && uiTitle[0] != '\0'); | ||||
#endif | #endif | ||||
carla_debug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); | carla_debug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); | ||||
#ifndef BUILD_BRIDGE_UI | |||||
return; (void)uiTitle; // unused | |||||
#endif | |||||
} | } | ||||
CarlaBridgeClient::~CarlaBridgeClient() | CarlaBridgeClient::~CarlaBridgeClient() | ||||