@@ -464,14 +464,14 @@ const char* const* RackGraph::getConnections() const noexcept | |||||
{ | { | ||||
case RACK_GRAPH_CARLA_PORT_AUDIO_IN1: | case RACK_GRAPH_CARLA_PORT_AUDIO_IN1: | ||||
case RACK_GRAPH_CARLA_PORT_AUDIO_IN2: | case RACK_GRAPH_CARLA_PORT_AUDIO_IN2: | ||||
std::snprintf(strBuf, STR_MAX, "AudioIn:%i", otherPort+1); | |||||
std::snprintf(strBuf, STR_MAX, "AudioIn:%i", otherPort); | |||||
connList.append(strBuf); | connList.append(strBuf); | ||||
connList.append(getCarlaRackFullPortNameFromId(carlaPort)); | connList.append(getCarlaRackFullPortNameFromId(carlaPort)); | ||||
break; | break; | ||||
case RACK_GRAPH_CARLA_PORT_AUDIO_OUT1: | case RACK_GRAPH_CARLA_PORT_AUDIO_OUT1: | ||||
case RACK_GRAPH_CARLA_PORT_AUDIO_OUT2: | case RACK_GRAPH_CARLA_PORT_AUDIO_OUT2: | ||||
std::snprintf(strBuf, STR_MAX, "AudioOut:%i", otherPort+1); | |||||
std::snprintf(strBuf, STR_MAX, "AudioOut:%i", otherPort); | |||||
connList.append(getCarlaRackFullPortNameFromId(carlaPort)); | connList.append(getCarlaRackFullPortNameFromId(carlaPort)); | ||||
connList.append(strBuf); | connList.append(strBuf); | ||||
break; | break; | ||||
@@ -516,7 +516,7 @@ bool RackGraph::getGroupAndPortIdFromFullName(const char* const fullPortName, ui | |||||
if (const int portTest = std::atoi(fullPortName+8)) | if (const int portTest = std::atoi(fullPortName+8)) | ||||
{ | { | ||||
portId = static_cast<uint>(portTest-1); | |||||
portId = static_cast<uint>(portTest); | |||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
@@ -526,7 +526,7 @@ bool RackGraph::getGroupAndPortIdFromFullName(const char* const fullPortName, ui | |||||
if (const int portTest = std::atoi(fullPortName+9)) | if (const int portTest = std::atoi(fullPortName+9)) | ||||
{ | { | ||||
portId = static_cast<uint>(portTest-1); | |||||
portId = static_cast<uint>(portTest); | |||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
@@ -749,10 +749,10 @@ void RackGraph::processHelper(CarlaEngine::ProtectedData* const data, const floa | |||||
for (LinkedList<uint>::Itenerator it = audio.connectedOut1.begin(); it.valid(); it.next()) | for (LinkedList<uint>::Itenerator it = audio.connectedOut1.begin(); it.valid(); it.next()) | ||||
{ | { | ||||
const uint& port(it.getValue(0)); | const uint& port(it.getValue(0)); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port != 0); | |||||
CARLA_SAFE_ASSERT_CONTINUE(port < outputs); | |||||
CARLA_SAFE_ASSERT_CONTINUE(port > 0); | |||||
CARLA_SAFE_ASSERT_CONTINUE(port <= outputs); | |||||
FloatVectorOperations::add(outBuf[port], audio.outBuf[0], iframes); | |||||
FloatVectorOperations::add(outBuf[port-1], audio.outBuf[0], iframes); | |||||
} | } | ||||
} | } | ||||
@@ -761,10 +761,10 @@ void RackGraph::processHelper(CarlaEngine::ProtectedData* const data, const floa | |||||
for (LinkedList<uint>::Itenerator it = audio.connectedOut2.begin(); it.valid(); it.next()) | for (LinkedList<uint>::Itenerator it = audio.connectedOut2.begin(); it.valid(); it.next()) | ||||
{ | { | ||||
const uint& port(it.getValue(0)); | const uint& port(it.getValue(0)); | ||||
CARLA_SAFE_ASSERT_CONTINUE(port != 0); | |||||
CARLA_SAFE_ASSERT_CONTINUE(port < outputs); | |||||
CARLA_SAFE_ASSERT_CONTINUE(port > 0); | |||||
CARLA_SAFE_ASSERT_CONTINUE(port <= outputs); | |||||
FloatVectorOperations::add(outBuf[port], audio.outBuf[1], iframes); | |||||
FloatVectorOperations::add(outBuf[port-1], audio.outBuf[1], iframes); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -34,12 +34,13 @@ CARLA_BACKEND_START_NAMESPACE | |||||
// Rack Graph stuff | // Rack Graph stuff | ||||
enum RackGraphGroupIds { | enum RackGraphGroupIds { | ||||
RACK_GRAPH_GROUP_CARLA = 0, | |||||
RACK_GRAPH_GROUP_AUDIO_IN = 1, | |||||
RACK_GRAPH_GROUP_AUDIO_OUT = 2, | |||||
RACK_GRAPH_GROUP_MIDI_IN = 3, | |||||
RACK_GRAPH_GROUP_MIDI_OUT = 4, | |||||
RACK_GRAPH_GROUP_MAX = 5 | |||||
RACK_GRAPH_GROUP_NULL = 0, | |||||
RACK_GRAPH_GROUP_CARLA = 1, | |||||
RACK_GRAPH_GROUP_AUDIO_IN = 2, | |||||
RACK_GRAPH_GROUP_AUDIO_OUT = 3, | |||||
RACK_GRAPH_GROUP_MIDI_IN = 4, | |||||
RACK_GRAPH_GROUP_MIDI_OUT = 5, | |||||
RACK_GRAPH_GROUP_MAX = 6 | |||||
}; | }; | ||||
enum RackGraphCarlaPortIds { | enum RackGraphCarlaPortIds { | ||||
@@ -320,7 +320,7 @@ public: | |||||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_GRAPH_GROUP_AUDIO_IN, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf); | callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_GRAPH_GROUP_AUDIO_IN, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf); | ||||
for (int i=0, count=inputNames.size(); i<count; ++i) | for (int i=0, count=inputNames.size(); i<count; ++i) | ||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_GRAPH_GROUP_AUDIO_IN, static_cast<int>(i), PATCHBAY_PORT_TYPE_AUDIO, 0.0f, inputNames[i].toRawUTF8()); | |||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_GRAPH_GROUP_AUDIO_IN, static_cast<int>(i)+1, PATCHBAY_PORT_TYPE_AUDIO, 0.0f, inputNames[i].toRawUTF8()); | |||||
} | } | ||||
// Audio Out | // Audio Out | ||||
@@ -335,7 +335,7 @@ public: | |||||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_GRAPH_GROUP_AUDIO_OUT, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf); | callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_GRAPH_GROUP_AUDIO_OUT, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf); | ||||
for (int i=0, count=outputNames.size(); i<count; ++i) | for (int i=0, count=outputNames.size(); i<count; ++i) | ||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_GRAPH_GROUP_AUDIO_OUT, static_cast<int>(i), PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, outputNames[i].toRawUTF8()); | |||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_GRAPH_GROUP_AUDIO_OUT, static_cast<int>(i)+1, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, outputNames[i].toRawUTF8()); | |||||
} | } | ||||
// MIDI In | // MIDI In | ||||
@@ -351,7 +351,7 @@ public: | |||||
std::snprintf(strBuf, STR_MAX, "Readable MIDI ports:%s", portName.toRawUTF8()); | std::snprintf(strBuf, STR_MAX, "Readable MIDI ports:%s", portName.toRawUTF8()); | ||||
PortNameToId portNameToId; | PortNameToId portNameToId; | ||||
portNameToId.setData(RACK_GRAPH_GROUP_MIDI_IN, static_cast<uint>(i), portName.toRawUTF8(), strBuf); | |||||
portNameToId.setData(RACK_GRAPH_GROUP_MIDI_IN, static_cast<uint>(i)+1, portName.toRawUTF8(), strBuf); | |||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), PATCHBAY_PORT_TYPE_MIDI, 0.0f, portNameToId.name); | callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), PATCHBAY_PORT_TYPE_MIDI, 0.0f, portNameToId.name); | ||||
@@ -372,7 +372,7 @@ public: | |||||
std::snprintf(strBuf, STR_MAX, "Writable MIDI ports:%s", portName.toRawUTF8()); | std::snprintf(strBuf, STR_MAX, "Writable MIDI ports:%s", portName.toRawUTF8()); | ||||
PortNameToId portNameToId; | PortNameToId portNameToId; | ||||
portNameToId.setData(RACK_GRAPH_GROUP_MIDI_OUT, static_cast<uint>(i), portName.toRawUTF8(), strBuf); | |||||
portNameToId.setData(RACK_GRAPH_GROUP_MIDI_OUT, static_cast<uint>(i)+1, portName.toRawUTF8(), strBuf); | |||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, 0.0f, portNameToId.name); | callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, 0.0f, portNameToId.name); | ||||
@@ -812,7 +812,8 @@ private: | |||||
void splice() | void splice() | ||||
{ | { | ||||
dataPending.moveTo(data, true /* append */); | |||||
if (dataPending.count() > 0) | |||||
dataPending.moveTo(data, true /* append */); | |||||
} | } | ||||
}; | }; | ||||
@@ -453,7 +453,7 @@ public: | |||||
for (uint i=0; i < fAudioInCount; ++i) | for (uint i=0; i < fAudioInCount; ++i) | ||||
{ | { | ||||
std::snprintf(strBuf, STR_MAX, "capture_%i", i+1); | std::snprintf(strBuf, STR_MAX, "capture_%i", i+1); | ||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_GRAPH_GROUP_AUDIO_IN, static_cast<int>(i), PATCHBAY_PORT_TYPE_AUDIO, 0.0f, strBuf); | |||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_GRAPH_GROUP_AUDIO_IN, static_cast<int>(i)+1, PATCHBAY_PORT_TYPE_AUDIO, 0.0f, strBuf); | |||||
} | } | ||||
} | } | ||||
@@ -469,7 +469,7 @@ public: | |||||
for (uint i=0; i < fAudioOutCount; ++i) | for (uint i=0; i < fAudioOutCount; ++i) | ||||
{ | { | ||||
std::snprintf(strBuf, STR_MAX, "playback_%i", i+1); | std::snprintf(strBuf, STR_MAX, "playback_%i", i+1); | ||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_GRAPH_GROUP_AUDIO_OUT, static_cast<int>(i), PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, strBuf); | |||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_GRAPH_GROUP_AUDIO_OUT, static_cast<int>(i)+1, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, strBuf); | |||||
} | } | ||||
} | } | ||||
@@ -486,7 +486,7 @@ public: | |||||
std::snprintf(strBuf, STR_MAX, "Readable MIDI ports:%s", portName.c_str()); | std::snprintf(strBuf, STR_MAX, "Readable MIDI ports:%s", portName.c_str()); | ||||
PortNameToId portNameToId; | PortNameToId portNameToId; | ||||
portNameToId.setData(RACK_GRAPH_GROUP_MIDI_IN, i, portName.c_str(), strBuf); | |||||
portNameToId.setData(RACK_GRAPH_GROUP_MIDI_IN, i+1, portName.c_str(), strBuf); | |||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), PATCHBAY_PORT_TYPE_MIDI, 0.0f, portNameToId.name); | callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), PATCHBAY_PORT_TYPE_MIDI, 0.0f, portNameToId.name); | ||||
@@ -507,7 +507,7 @@ public: | |||||
std::snprintf(strBuf, STR_MAX, "Writable MIDI ports:%s", portName.c_str()); | std::snprintf(strBuf, STR_MAX, "Writable MIDI ports:%s", portName.c_str()); | ||||
PortNameToId portNameToId; | PortNameToId portNameToId; | ||||
portNameToId.setData(RACK_GRAPH_GROUP_MIDI_OUT, i, portName.c_str(), strBuf); | |||||
portNameToId.setData(RACK_GRAPH_GROUP_MIDI_OUT, i+1, portName.c_str(), strBuf); | |||||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, 0.0f, portNameToId.name); | callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, 0.0f, portNameToId.name); | ||||
@@ -1070,7 +1070,8 @@ private: | |||||
void splice() | void splice() | ||||
{ | { | ||||
dataPending.moveTo(data, true /* append */); | |||||
if (dataPending.count() > 0) | |||||
dataPending.moveTo(data, true /* append */); | |||||
} | } | ||||
}; | }; | ||||