Programmatically add wires between moduels

Yes, you can add wires prgrammatically. I wouldn’t suggest it though. The way to go would be using something like Mutes or a matrix mixer to switch connections on or off.

CableWidget* cw = new CableWidget;
cw->color = color::fromHexString(colorStr);

for (PortWidget *port : outputModule->outputs) {
  if (port->portId == outputId) {
    cw->setOutput(port);
    break;
  }
}
for (PortWidget *port : inputModule->inputs) {
  if (port->portId == inputId) {
    cw->setInput(port);
    break;
  }
}
if (cw->isComplete()) {
  APP->scene->rack->addCable(cw);
}
1 Like