def get_all_ports_and_connections(self): self.port_list.clear() self.connection_list.clear() self.metadata_list.clear() #get all currents Jack ports and connections port_name_list = c_char_p_p_to_list( jacklib.get_ports(self.jack_client, "", "", 0)) client_names = [] for port_name in port_name_list: port_ptr = jacklib.port_by_name(self.jack_client, port_name) jport = JackPort(port_name, self.jack_client) self.port_list.append(jport) client_name = port_name.partition(':')[0] if not client_name in client_names: client_names.append(client_name) # get port metadatas for key in (jacklib.JACK_METADATA_CONNECTED, jacklib.JACK_METADATA_ORDER, jacklib.JACK_METADATA_PORT_GROUP, jacklib.JACK_METADATA_PRETTY_NAME): prop = jacklib.get_property(jport.uuid, key) if prop is None: continue value = self.get_metadata_value_str(prop) self.metadata_list.append({ 'uuid': jport.uuid, 'key': key, 'value': value }) if jport.flags & jacklib.JackPortIsInput: continue port_ptr = jacklib.port_by_name(self.jack_client, jport.name) # this port is output, list its connections port_connection_names = tuple( jacklib.port_get_all_connections(self.jack_client, port_ptr)) for port_con_name in port_connection_names: self.connection_list.append((jport.name, port_con_name)) for client_name in client_names: uuid = jacklib.get_uuid_for_client_name(self.jack_client, client_name) if not uuid: continue self.client_list.append({'name': client_name, 'uuid': int(uuid)})
if portTypeStr == jacklib.JACK_DEFAULT_AUDIO_TYPE: jack_port.type = PORT_TYPE_AUDIO elif portTypeStr == jacklib.JACK_DEFAULT_MIDI_TYPE: jack_port.type = PORT_TYPE_MIDI else: jack_port.type = PORT_TYPE_NULL jack_port.is_new = True port_list.append(jack_port) if jacklib.port_flags(portPtr) & jacklib.JackPortIsInput: continue portConnectionNames = c_char_p_p_to_list( jacklib.port_get_all_connections(jack_client, portPtr)) for portConName in portConnectionNames: connection_list.append((portName, portConName)) app = QCoreApplication(sys.argv) #needed for signals SIGINT, SIGTERM timer = QTimer() timer.start(200) timer.timeout.connect(lambda: None) connect_timer = ConnectTimer() dirty_checker = DirtyChecker()