@@ -27,6 +27,7 @@ | |||
#include <QtCore/QStringList> | |||
#define URI_CANVAS_CV "http://kxstudio.sf.net/ns/canvas/cv" | |||
#define URI_CANVAS_ICON "http://kxstudio.sf.net/ns/canvas/icon" | |||
CARLA_BACKEND_START_NAMESPACE | |||
@@ -58,11 +59,10 @@ public: | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
CARLA_SAFE_ASSERT(client != nullptr && port != nullptr); | |||
#if 0 | |||
if (jack_uuid_t uuid = jackbridge_port_uuid(port)) | |||
jackbridge_set_property(client, uuid, "urn:jack:IsControlVoltage", "NO", "text/plain"); | |||
#endif | |||
CARLA_SAFE_ASSERT_RETURN(client != nullptr && port != nullptr,); | |||
if (const jack_uuid_t uuid = jackbridge_port_uuid(port)) | |||
jackbridge_set_property(client, uuid, URI_CANVAS_CV, "NO", "text/plain"); | |||
} | |||
else | |||
{ | |||
@@ -76,6 +76,9 @@ public: | |||
if (fClient != nullptr && fPort != nullptr) | |||
{ | |||
if (const jack_uuid_t uuid = jackbridge_port_uuid(fPort)) | |||
jackbridge_remove_property(fClient, uuid, URI_CANVAS_CV); | |||
try { | |||
jackbridge_port_unregister(fClient, fPort); | |||
} catch(...) {} | |||
@@ -129,11 +132,10 @@ public: | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
CARLA_SAFE_ASSERT(client != nullptr && port != nullptr); | |||
#if 0 | |||
if (jack_uuid_t uuid = jackbridge_port_uuid(port)) | |||
jackbridge_set_property(client, uuid, "urn:jack:IsControlVoltage", "YES", "text/plain"); | |||
#endif | |||
CARLA_SAFE_ASSERT_RETURN(client != nullptr && port != nullptr,); | |||
if (const jack_uuid_t uuid = jackbridge_port_uuid(port)) | |||
jackbridge_set_property(client, uuid, URI_CANVAS_CV, "YES", "text/plain"); | |||
} | |||
else | |||
{ | |||
@@ -147,6 +149,9 @@ public: | |||
if (fClient != nullptr && fPort != nullptr) | |||
{ | |||
if (const jack_uuid_t uuid = jackbridge_port_uuid(fPort)) | |||
jackbridge_remove_property(fClient, uuid, URI_CANVAS_CV); | |||
try { | |||
jackbridge_port_unregister(fClient, fPort); | |||
} catch(...) {} | |||
@@ -1424,13 +1429,13 @@ protected: | |||
bool portIsAudio = (std::strcmp(jackbridge_port_type(jackPort), JACK_DEFAULT_AUDIO_TYPE) == 0); | |||
bool portIsCV = false; | |||
//if (jack_uuid_t uuid = jackbridge_port_uuid(jackPort)) | |||
if (const jack_uuid_t uuid = jackbridge_port_uuid(jackPort)) | |||
{ | |||
//char* value = nullptr; | |||
//char* type = nullptr; | |||
char* value = nullptr; | |||
char* type = nullptr; | |||
//if (jackbridge_get_property(uuid, "urn:jack:IsControlVoltage", &value, &type) && value != nullptr && type != nullptr && std::strcmp(type, "text/plain") == 0) | |||
// portIsCV = (std::strcmp(value, "YES") == 0); | |||
if (jackbridge_get_property(uuid, URI_CANVAS_CV, &value, &type) && value != nullptr && type != nullptr && std::strcmp(type, "text/plain") == 0) | |||
portIsCV = (std::strcmp(value, "YES") == 0); | |||
} | |||
unsigned int canvasPortFlags = 0x0; | |||
@@ -1902,13 +1907,13 @@ private: | |||
bool portIsAudio = (std::strcmp(jackbridge_port_type(jackPort), JACK_DEFAULT_AUDIO_TYPE) == 0); | |||
bool portIsCV = false; | |||
//if (jack_uuid_t uuid = jackbridge_port_uuid(jackPort)) | |||
if (const jack_uuid_t uuid = jackbridge_port_uuid(jackPort)) | |||
{ | |||
//char* value = nullptr; | |||
//char* type = nullptr; | |||
char* value = nullptr; | |||
char* type = nullptr; | |||
//if (jackbridge_get_property(uuid, "urn:jack:IsControlVoltage", &value, &type) && value != nullptr && type != nullptr && std::strcmp(type, "text/plain") == 0) | |||
// portIsCV = (std::strcmp(value, "YES") == 0); | |||
if (jackbridge_get_property(uuid, URI_CANVAS_CV, &value, &type) && value != nullptr && type != nullptr && std::strcmp(type, "text/plain") == 0) | |||
portIsCV = (std::strcmp(value, "YES") == 0); | |||
} | |||
unsigned int canvasPortFlags = 0x0; | |||
@@ -854,6 +854,8 @@ class CarlaPatchbayW(QFrame): | |||
@pyqtSlot(int, int, int, str) | |||
def slot_handlePatchbayPortAddedCallback(self, clientId, portId, portFlags, portName): | |||
isAlternate = False | |||
if (portFlags & PATCHBAY_PORT_IS_INPUT): | |||
portMode = patchcanvas.PORT_MODE_INPUT | |||
else: | |||
@@ -862,13 +864,18 @@ class CarlaPatchbayW(QFrame): | |||
if (portFlags & PATCHBAY_PORT_TYPE_AUDIO): | |||
portType = patchcanvas.PORT_TYPE_AUDIO_JACK | |||
elif (portFlags & PATCHBAY_PORT_TYPE_CV): | |||
portType = patchcanvas.PORT_TYPE_AUDIO_JACK # TODO | |||
portType = patchcanvas.PORT_TYPE_AUDIO_JACK | |||
elif (portFlags & PATCHBAY_PORT_TYPE_MIDI): | |||
portType = patchcanvas.PORT_TYPE_MIDI_JACK | |||
#elif (portFlags & PATCHBAY_PORT_TYPE_PARAMETER): | |||
#portType = patchcanvas.PORT_TYPE_PARAMETER | |||
else: | |||
portType = patchcanvas.PORT_TYPE_NULL | |||
patchcanvas.addPort(clientId, portId, portName, portMode, portType) | |||
if (portFlags & PATCHBAY_PORT_TYPE_CV): | |||
isAlternate = True | |||
patchcanvas.addPort(clientId, portId, portName, portMode, portType, isAlternate) | |||
QTimer.singleShot(0, self.fMiniCanvasPreview.update) | |||
@pyqtSlot(int, int) | |||
@@ -1483,7 +1483,7 @@ class CanvasLine(QGraphicsLineItem): | |||
elif port_type1 == PORT_TYPE_MIDI_ALSA: | |||
port_gradient.setColorAt(pos1, canvas.theme.line_midi_alsa_sel if self.m_lineSelected else canvas.theme.line_midi_alsa) | |||
elif port_type1 == PORT_TYPE_PARAMETER: | |||
pass # TODO | |||
port_gradient.setColorAt(pos1, canvas.theme.line_parameter_sel if self.m_lineSelected else canvas.theme.line_parameter) | |||
if port_type2 == PORT_TYPE_AUDIO_JACK: | |||
port_gradient.setColorAt(pos2, canvas.theme.line_audio_jack_sel if self.m_lineSelected else canvas.theme.line_audio_jack) | |||
@@ -1492,7 +1492,7 @@ class CanvasLine(QGraphicsLineItem): | |||
elif port_type2 == PORT_TYPE_MIDI_ALSA: | |||
port_gradient.setColorAt(pos2, canvas.theme.line_midi_alsa_sel if self.m_lineSelected else canvas.theme.line_midi_alsa) | |||
elif port_type2 == PORT_TYPE_PARAMETER: | |||
pass # TODO | |||
port_gradient.setColorAt(pos2, canvas.theme.line_parameter_sel if self.m_lineSelected else canvas.theme.line_parameter) | |||
self.setPen(QPen(port_gradient, 2)) | |||
@@ -1590,7 +1590,7 @@ class CanvasBezierLine(QGraphicsPathItem): | |||
elif port_type1 == PORT_TYPE_MIDI_ALSA: | |||
port_gradient.setColorAt(pos1, canvas.theme.line_midi_alsa_sel if self.m_lineSelected else canvas.theme.line_midi_alsa) | |||
elif port_type1 == PORT_TYPE_PARAMETER: | |||
pass # TODO | |||
port_gradient.setColorAt(pos1, canvas.theme.line_parameter_sel if self.m_lineSelected else canvas.theme.line_parameter) | |||
if port_type2 == PORT_TYPE_AUDIO_JACK: | |||
port_gradient.setColorAt(pos2, canvas.theme.line_audio_jack_sel if self.m_lineSelected else canvas.theme.line_audio_jack) | |||
@@ -1599,7 +1599,7 @@ class CanvasBezierLine(QGraphicsPathItem): | |||
elif port_type2 == PORT_TYPE_MIDI_ALSA: | |||
port_gradient.setColorAt(pos2, canvas.theme.line_midi_alsa_sel if self.m_lineSelected else canvas.theme.line_midi_alsa) | |||
elif port_type2 == PORT_TYPE_PARAMETER: | |||
pass # TODO | |||
port_gradient.setColorAt(pos2, canvas.theme.line_parameter_sel if self.m_lineSelected else canvas.theme.line_parameter) | |||
self.setPen(QPen(port_gradient, 2)) | |||
@@ -1631,7 +1631,7 @@ class CanvasLineMov(QGraphicsLineItem): | |||
elif port_type == PORT_TYPE_MIDI_ALSA: | |||
pen = QPen(canvas.theme.line_midi_alsa, 2) | |||
elif port_type == PORT_TYPE_PARAMETER: | |||
pass # TODO | |||
pen = QPen(canvas.theme.line_parameter, 2) | |||
else: | |||
qWarning("PatchCanvas::CanvasLineMov(%s, %s, %s) - invalid port type" % (port_mode2str(port_mode), port_type2str(port_type), parent)) | |||
pen = QPen(Qt.black) | |||
@@ -1688,7 +1688,7 @@ class CanvasBezierLineMov(QGraphicsPathItem): | |||
elif port_type == PORT_TYPE_MIDI_ALSA: | |||
pen = QPen(canvas.theme.line_midi_alsa, 2) | |||
elif port_type == PORT_TYPE_PARAMETER: | |||
pass # TODO | |||
pen = QPen(canvas.theme.line_parameter, 2) | |||
else: | |||
qWarning("PatchCanvas::CanvasBezierLineMov(%s, %s, %s) - invalid port type" % (port_mode2str(port_mode), port_type2str(port_type), parent)) | |||
pen = QPen(Qt.black) | |||
@@ -2013,11 +2013,20 @@ class CanvasPort(QGraphicsItem): | |||
text_pen = canvas.theme.port_midi_alsa_text_sel if self.isSelected() else canvas.theme.port_midi_alsa_text | |||
conn_pen = canvas.theme.port_midi_alsa_pen_sel | |||
elif self.m_port_type == PORT_TYPE_PARAMETER: | |||
pass # TODO | |||
poly_color = canvas.theme.port_parameter_bg_sel if self.isSelected() else canvas.theme.port_parameter_bg | |||
poly_pen = canvas.theme.port_parameter_pen_sel if self.isSelected() else canvas.theme.port_parameter_pen | |||
text_pen = canvas.theme.port_parameter_text_sel if self.isSelected() else canvas.theme.port_parameter_text | |||
conn_pen = canvas.theme.port_parameter_pen_sel | |||
else: | |||
qCritical("PatchCanvas::CanvasPort.paint() - invalid port type '%s'" % port_type2str(self.m_port_type)) | |||
return | |||
if self.m_is_alternate: | |||
poly_color = poly_color.darker(180) | |||
#poly_pen.setColor(poly_pen.color().darker(110)) | |||
#text_pen.setColor(text_pen.color()) #.darker(150)) | |||
#conn_pen.setColor(conn_pen.color()) #.darker(150)) | |||
polygon = QPolygonF() | |||
polygon += QPointF(poly_locx[0], 0) | |||
polygon += QPointF(poly_locx[1], 0) | |||
@@ -2773,7 +2782,7 @@ class CanvasPortGlow(QGraphicsDropShadowEffect): | |||
elif port_type == PORT_TYPE_MIDI_ALSA: | |||
self.setColor(canvas.theme.line_midi_alsa_glow) | |||
elif port_type == PORT_TYPE_PARAMETER: | |||
pass # TODO | |||
self.setColor(canvas.theme.line_parameter_glow) | |||
# ------------------------------------------------------------------------------ | |||
# canvasboxshadow.cpp | |||