diff --git a/mod/host.py b/mod/host.py index e69b42383..1273935e0 100644 --- a/mod/host.py +++ b/mod/host.py @@ -543,9 +543,10 @@ def jack_bufsize_changed(self, bufSize): self.msg_callback("bufsize %i" % bufSize) def jack_port_appeared(self, name, isOutput): - name = charPtrToString(name) - isOutput = bool(isOutput) + # Public entry from the JACK port scan. + self._handle_port_appeared(charPtrToString(name), bool(isOutput), retries=6) + def _handle_port_appeared(self, name, isOutput, retries): if name.startswith(self.jack_slave_prefix+":"): name = name.replace(self.jack_slave_prefix+":","") if name.startswith("midi_"): @@ -569,11 +570,18 @@ def jack_port_appeared(self, name, isOutput): return if self.midi_aggregated_mode: - # new ports are ignored under midi aggregated mode + # New ports are ignored in aggregated mode. The merger JACK client + # owns the connection to mod-midi-merger:in (its port-registration + # callback plus a bounded reconcile burst). The graph shows only + # the merged ports. return alias = get_jack_port_alias(name) if not alias: + # The alias is not ready. Try again after a short delay. + if retries > 0: + IOLoop.instance().call_later( + 0.5, self._handle_port_appeared, name, isOutput, retries - 1) return alias = midi_port_alias_to_name(alias, True)