Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-rc1
@@ -355,6 +355,40 @@ static const uint PATCHBAY_PORT_TYPE_OSC = 0x10; | |||
/** @} */ | |||
/** @} */ | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* Patchbay Port Group Hints */ | |||
/*! | |||
* @defgroup PatchbayPortGroupHints Patchbay Port Group Hints | |||
* | |||
* Various patchbay port group hints. | |||
* @{ | |||
*/ | |||
/*! | |||
* Indicates that this group should be considered the "main" input. | |||
*/ | |||
static const uint PATCHBAY_PORT_GROUP_MAIN_INPUT = 0x01; | |||
/*! | |||
* Indicates that this group should be considered the "main" output. | |||
*/ | |||
static const uint PATCHBAY_PORT_GROUP_MAIN_OUTPUT = 0x02; | |||
/*! | |||
* A stereo port group, where the 1st port is left and the 2nd is right. | |||
*/ | |||
static const uint PATCHBAY_PORT_GROUP_STEREO = 0x04; | |||
/*! | |||
* A mid-side stereo group, where the 1st port is center and the 2nd is side. | |||
*/ | |||
static const uint PATCHBAY_PORT_GROUP_MID_SIDE = 0x08; | |||
/** @} */ | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* Custom Data Types */ | |||
@@ -864,6 +898,7 @@ typedef enum { | |||
* @a pluginId Client Id | |||
* @a value1 Port Id | |||
* @a value2 Port hints | |||
* @a value3 Port group Id (0 for none) | |||
* @a valueStr Port name | |||
* @see PatchbayPortHints | |||
*/ | |||
@@ -877,12 +912,14 @@ typedef enum { | |||
ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25, | |||
/*! | |||
* A patchbay port has been renamed. | |||
* A patchbay port has changed (like the name or group Id). | |||
* @a pluginId Client Id | |||
* @a value1 Port Id | |||
* @a valueStr New port name | |||
* @a value2 Port hints | |||
* @a value3 Port group Id (0 for none) | |||
* @a valueStr Port name | |||
*/ | |||
ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 26, | |||
ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED = 26, | |||
/*! | |||
* A patchbay connection has been added. | |||
@@ -996,6 +1033,33 @@ typedef enum { | |||
*/ | |||
ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW = 42, | |||
/*! | |||
* A patchbay port group has been added. | |||
* @a pluginId Client Id | |||
* @a value1 Group Id (unique value within this client) | |||
* @a value2 Group hints | |||
* @a valueStr Group name | |||
* @see PatchbayPortGroupHints | |||
*/ | |||
ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED = 43, | |||
/*! | |||
* A patchbay port group has been removed. | |||
* @a pluginId Client Id | |||
* @a value1 Group Id | |||
*/ | |||
ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED = 44, | |||
/*! | |||
* A patchbay port group has changed. | |||
* @a pluginId Client Id | |||
* @a value1 Group Id | |||
* @a value2 Group hints | |||
* @a valueStr Group name | |||
* @see PatchbayPortGroupHints | |||
*/ | |||
ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED = 45, | |||
} EngineCallbackOpcode; | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
@@ -2268,7 +2268,7 @@ protected: | |||
portNameToId.rename(shortPortName, newFullName); | |||
callback(fExternalPatchbayHost, fExternalPatchbayOsc, | |||
ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED, | |||
ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED, | |||
portNameToId.group, | |||
static_cast<int>(portNameToId.port), | |||
0, 0, 0.0f, | |||
@@ -314,6 +314,22 @@ PATCHBAY_PORT_TYPE_MIDI = 0x08 | |||
# Patchbay port is of OSC type. | |||
PATCHBAY_PORT_TYPE_OSC = 0x10 | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Patchbay Port Group Hints | |||
# Various patchbay port group hints. | |||
# Indicates that this group should be considered the "main" input. | |||
PATCHBAY_PORT_GROUP_MAIN_INPUT = 0x01 | |||
# Indicates that this group should be considered the "main" output. | |||
PATCHBAY_PORT_GROUP_MAIN_OUTPUT = 0x02 | |||
# A stereo port group, where the 1st port is left and the 2nd is right. | |||
PATCHBAY_PORT_GROUP_STEREO = 0x04 | |||
# A mid-side stereo group, where the 1st port is center and the 2nd is side. | |||
PATCHBAY_PORT_GROUP_MID_SIDE = 0x08 | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Custom Data Types | |||
# These types define how the value in the CustomData struct is stored. | |||
@@ -636,6 +652,7 @@ ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23 | |||
# @a pluginId Client Id | |||
# @a value1 Port Id | |||
# @a value2 Port hints | |||
# @a value3 Port group Id (0 for none) | |||
# @a valueStr Port name | |||
# @see PatchbayPortHints | |||
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24 | |||
@@ -645,11 +662,13 @@ ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24 | |||
# @a value1 Port Id | |||
ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25 | |||
# A patchbay port has been renamed. | |||
# A patchbay port has changed (like the name or group Id). | |||
# @a pluginId Client Id | |||
# @a value1 Port Id | |||
# @a value2 Port hints | |||
# @a value3 Port group Id (0 for none) | |||
# @a valueStr New port name | |||
ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 26 | |||
ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED = 26 | |||
# A patchbay connection has been added. | |||
# @a pluginId Connection Id | |||
@@ -730,6 +749,27 @@ ENGINE_CALLBACK_QUIT = 41 | |||
# @a pluginId Plugin Id to redraw | |||
ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW = 42 | |||
# A patchbay port group has been added. | |||
# @a pluginId Client Id | |||
# @a value1 Group Id (unique within this client) | |||
# @a value2 Group hints | |||
# @a valueStr Group name | |||
# @see PatchbayPortGroupHints | |||
ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED = 43 | |||
# A patchbay port group has been removed. | |||
# @a pluginId Client Id | |||
# @a value1 Group Id (unique within this client) | |||
ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED = 44 | |||
# A patchbay port group has changed. | |||
# @a pluginId Client Id | |||
# @a value1 Group Id (unique within this client) | |||
# @a value2 Group hints | |||
# @a valueStr Group name | |||
# @see PatchbayPortGroupHints | |||
ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED = 45 | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# NSM Callback Opcode | |||
# NSM callback opcodes. | |||
@@ -55,9 +55,12 @@ class CarlaHostSignals(QObject): | |||
PatchbayClientRemovedCallback = pyqtSignal(int) | |||
PatchbayClientRenamedCallback = pyqtSignal(int, str) | |||
PatchbayClientDataChangedCallback = pyqtSignal(int, int, int) | |||
PatchbayPortAddedCallback = pyqtSignal(int, int, int, str) | |||
PatchbayPortAddedCallback = pyqtSignal(int, int, int, int, str) | |||
PatchbayPortRemovedCallback = pyqtSignal(int, int) | |||
PatchbayPortRenamedCallback = pyqtSignal(int, int, str) | |||
PatchbayPortChangedCallback = pyqtSignal(int, int, int, int, str) | |||
PatchbayPortGroupAddedCallback = pyqtSignal(int, int, int, str) | |||
PatchbayPortGroupRemovedCallback = pyqtSignal(int, int) | |||
PatchbayPortGroupChangedCallback = pyqtSignal(int, int, int, str) | |||
PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int) | |||
PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int) | |||
EngineStartedCallback = pyqtSignal(int, int, int, int, float, str) | |||
@@ -519,7 +519,11 @@ class HostWindow(QMainWindow): | |||
host.PatchbayClientDataChangedCallback.connect(self.slot_handlePatchbayClientDataChangedCallback) | |||
host.PatchbayPortAddedCallback.connect(self.slot_handlePatchbayPortAddedCallback) | |||
host.PatchbayPortRemovedCallback.connect(self.slot_handlePatchbayPortRemovedCallback) | |||
host.PatchbayPortRenamedCallback.connect(self.slot_handlePatchbayPortRenamedCallback) | |||
host.PatchbayPortChangedCallback.connect(self.slot_handlePatchbayPortChangedCallback) | |||
host.PatchbayPortGroupAddedCallback.connect(self.slot_handlePatchbayPortGroupAddedCallback) | |||
host.PatchbayPortGroupRemovedCallback.connect(self.slot_handlePatchbayPortGroupRemovedCallback) | |||
host.PatchbayPortGroupChangedCallback.connect(self.slot_handlePatchbayPortGroupChangedCallback) | |||
host.PatchbayConnectionAddedCallback.connect(self.slot_handlePatchbayConnectionAddedCallback) | |||
host.PatchbayConnectionRemovedCallback.connect(self.slot_handlePatchbayConnectionRemovedCallback) | |||
@@ -1584,8 +1588,8 @@ class HostWindow(QMainWindow): | |||
patchcanvas.setGroupAsPlugin(clientId, pluginId, hasCustomUI, hasInlineDisplay) | |||
@pyqtSlot(int, int, int, str) | |||
def slot_handlePatchbayPortAddedCallback(self, clientId, portId, portFlags, portName): | |||
@pyqtSlot(int, int, int, int, str) | |||
def slot_handlePatchbayPortAddedCallback(self, clientId, portId, portFlags, portGroupId, portName): | |||
if portFlags & PATCHBAY_PORT_IS_INPUT: | |||
portMode = patchcanvas.PORT_MODE_INPUT | |||
else: | |||
@@ -1612,11 +1616,26 @@ class HostWindow(QMainWindow): | |||
patchcanvas.removePort(groupId, portId) | |||
self.updateMiniCanvasLater() | |||
@pyqtSlot(int, int, str) | |||
def slot_handlePatchbayPortRenamedCallback(self, groupId, portId, newPortName): | |||
@pyqtSlot(int, int, int, int, str) | |||
def slot_handlePatchbayPortChangedCallback(self, groupId, portId, portFlags, portGroupId, newPortName): | |||
patchcanvas.renamePort(groupId, portId, newPortName) | |||
self.updateMiniCanvasLater() | |||
@pyqtSlot(int, int, int, str) | |||
def slot_handlePatchbayPortGroupAddedCallback(self, groupId, portId, portGroupId, newPortName): | |||
# TODO | |||
pass | |||
@pyqtSlot(int, int) | |||
def slot_handlePatchbayPortGroupRemovedCallback(self, groupId, portId): | |||
# TODO | |||
pass | |||
@pyqtSlot(int, int, int, str) | |||
def slot_handlePatchbayPortGroupChangedCallback(self, groupId, portId, portGroupId, newPortName): | |||
# TODO | |||
pass | |||
@pyqtSlot(int, int, int, int, int) | |||
def slot_handlePatchbayConnectionAddedCallback(self, connectionId, groupOutId, portOutId, groupInId, portInId): | |||
patchcanvas.connectPorts(connectionId, groupOutId, portOutId, groupInId, portInId) | |||
@@ -2710,11 +2729,17 @@ def engineCallback(host, action, pluginId, value1, value2, value3, valuef, value | |||
elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED: | |||
host.PatchbayClientDataChangedCallback.emit(pluginId, value1, value2) | |||
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_ADDED: | |||
host.PatchbayPortAddedCallback.emit(pluginId, value1, value2, valueStr) | |||
host.PatchbayPortAddedCallback.emit(pluginId, value1, value2, value3, valueStr) | |||
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED: | |||
host.PatchbayPortRemovedCallback.emit(pluginId, value1) | |||
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED: | |||
host.PatchbayPortRenamedCallback.emit(pluginId, value1, valueStr) | |||
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED: | |||
host.PatchbayPortChangedCallback.emit(pluginId, value1, value2, value3, valueStr) | |||
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED: | |||
host.PatchbayPortGroupAddedCallback.emit(pluginId, value1, value2, valueStr) | |||
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED: | |||
host.PatchbayPortGroupRemovedCallback.emit(pluginId, value1) | |||
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED: | |||
host.PatchbayPortGroupChangedCallback.emit(pluginId, value1, value2, valueStr) | |||
elif action == ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED: | |||
gOut, pOut, gIn, pIn = [int(i) for i in valueStr.split(":")] # FIXME | |||
host.PatchbayConnectionAddedCallback.emit(pluginId, gOut, pOut, gIn, pIn) | |||
@@ -251,8 +251,8 @@ const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED"; | |||
case ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED: | |||
return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED"; | |||
case ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED: | |||
@@ -286,6 +286,12 @@ const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept | |||
return "ENGINE_CALLBACK_QUIT"; | |||
case ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW: | |||
return "ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED"; | |||
} | |||
carla_stderr("CarlaBackend::EngineCallbackOpcode2Str(%i) - invalid opcode", opcode); | |||