예제 #1
0
    def port_reg_callback(self, port_id, action, *args):
        port = jacklib.port_by_id(self.client, port_id)
        if action == 0:
            log.debug("Port unregistered: %s", jacklib.port_name(port))
        else:
            port = jacklib.port_by_id(self.client, port_id)
            log.debug("New port registered: %s", jacklib.port_name(port))

        self._refresh()
예제 #2
0
def JackPortConnectCallback(port_id_A, port_id_B, connect_yesno, arg=None):
    port_ptr_A = jacklib.port_by_id(jack_client, port_id_A)
    port_ptr_B = jacklib.port_by_id(jack_client, port_id_B)

    port_str_A = str(jacklib.port_name(port_ptr_A), encoding="utf-8")
    port_str_B = str(jacklib.port_name(port_ptr_B), encoding="utf-8")

    if connect_yesno:
        signaler.connection_added.emit(port_str_A, port_str_B)
    else:
        signaler.connection_removed.emit(port_str_A, port_str_B)

    return 0
예제 #3
0
def JackPortRegistrationCallback(portId, registerYesNo, arg=None):
    portPtr = jacklib.port_by_id(jack_client, portId)
    portFlags = jacklib.port_flags(portPtr)
    port_name = str(jacklib.port_name(portPtr), encoding="utf-8")

    port_mode = PORT_MODE_NULL

    if portFlags & jacklib.JackPortIsInput:
        port_mode = PORT_MODE_INPUT
    elif portFlags & jacklib.JackPortIsOutput:
        port_mode = PORT_MODE_OUTPUT

    port_type = PORT_TYPE_NULL

    portTypeStr = str(jacklib.port_type(portPtr), encoding="utf-8")
    if portTypeStr == jacklib.JACK_DEFAULT_AUDIO_TYPE:
        port_type = PORT_TYPE_AUDIO
    elif portTypeStr == jacklib.JACK_DEFAULT_MIDI_TYPE:
        port_type = PORT_TYPE_MIDI

    if registerYesNo:
        signaler.port_added.emit(port_name, port_mode, port_type)
    else:
        signaler.port_removed.emit(port_name, port_mode, port_type)

    return 0
예제 #4
0
    def jack_port_connect_callback(self,
                                   port_id_A: int,
                                   port_id_B: int,
                                   connect_yesno: bool,
                                   arg=None) -> int:
        #if not self.jack_client:
        #return 0

        port_ptr_A = jacklib.port_by_id(self.jack_client, port_id_A)
        port_ptr_B = jacklib.port_by_id(self.jack_client, port_id_B)

        port_str_A = jacklib.port_name(port_ptr_A)
        port_str_B = jacklib.port_name(port_ptr_B)

        connection = (port_str_A, port_str_B)

        if connect_yesno:
            self.connection_list.append(connection)
            self.osc_server.connection_added(connection)
        elif connection in self.connection_list:
            self.connection_list.remove(connection)
            self.osc_server.connection_removed(connection)

        return 0
예제 #5
0
    def jack_port_registration_callback(self,
                                        port_id: int,
                                        register: bool,
                                        arg=None) -> int:
        if not self.jack_client:
            return 0

        port_ptr = jacklib.port_by_id(self.jack_client, port_id)
        port_name = jacklib.port_name(port_ptr)

        if register:
            jport = JackPort(port_name, self.jack_client, port_ptr)
            self.port_list.append(jport)
            self.osc_server.port_added(jport)
        else:
            for jport in self.port_list:
                if jport.name == port_name:
                    self.port_list.remove(jport)
                    self.osc_server.port_removed(jport)
                    break
        return 0