Пример #1
0
int 
jack_port_request_monitor_by_name (jack_client_t *client,
				   const char *port_name, int onoff)

{
	jack_port_t *port;
	unsigned long i, limit;
	jack_port_shared_t *ports;

	limit = client->engine->port_max;
	ports = &client->engine->ports[0];
	
	for (i = 0; i < limit; i++) {
		if (ports[i].in_use &&
		    strcmp (ports[i].name, port_name) == 0) {
			port = jack_port_new (client, ports[i].id,
					      client->engine);
			return jack_port_request_monitor (port, onoff);
			free (port);
			return 0;
		}
	}

	return -1;
}
Пример #2
0
jack_port_t *
jack_port_by_name_int (jack_client_t *client, const char *port_name, int* free)
{
	JSList *node;
	for (node = client->ports; node; node = jack_slist_next (node)) {
		if (jack_port_name_equals(((jack_port_t *) node->data)->shared, port_name)) {
			*free = FALSE;
			return (jack_port_t *) node->data;
		}
	}

	unsigned long i, limit;
	jack_port_shared_t *port;

	limit = client->engine->port_max;
	port = &client->engine->ports[0];

	for (i = 0; i < limit; i++) {
		if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
			*free = TRUE;
			return jack_port_new (client, port[i].id,
					      client->engine);
		}
	}

	return NULL;
}
Пример #3
0
jack_port_t *
jack_port_register (jack_client_t *client, 
		    const char *port_name,
		    const char *port_type,
		    unsigned long flags,
		    unsigned long buffer_size)
{
	jack_request_t req;
	jack_port_t *port = 0;
	int length ;

        VALGRIND_MEMSET (&req, 0, sizeof (req));

	req.type = RegisterPort;

	length = strlen ((const char *) client->control->name)
		+ 1 + strlen (port_name);
	if ( length >= sizeof (req.x.port_info.name) ) {
	  jack_error ("\"%s:%s\" is too long to be used as a JACK port name.\n"
		      "Please use %lu characters or less.",
		      client->control->name , 
		      port_name,
		      sizeof (req.x.port_info.name) - 1);
	  return NULL ;
	}

	strcpy ((char *) req.x.port_info.name,
		(const char *) client->control->name);
	strcat ((char *) req.x.port_info.name, ":");
	strcat ((char *) req.x.port_info.name, port_name);

	snprintf (req.x.port_info.type, sizeof (req.x.port_info.type),
		  "%s", port_type);
	req.x.port_info.flags = flags;
	req.x.port_info.buffer_size = buffer_size;
	jack_uuid_copy (req.x.port_info.client_id, client->control->uuid);

	if (jack_client_deliver_request (client, &req)) {
		jack_error ("cannot deliver port registration request");
		return NULL;
	}

	if ((port = jack_port_new (client, req.x.port_info.port_id,
				   client->engine)) == NULL) {
		jack_error ("cannot allocate client side port structure");
		return NULL;
	}

	client->ports = jack_slist_prepend (client->ports, port);

	return port;
}
Пример #4
0
jack_port_t *
jack_port_by_name_int (jack_client_t *client, const char *port_name)
{
	unsigned long i, limit;
	jack_port_shared_t *port;
	
	limit = client->engine->port_max;
	port = &client->engine->ports[0];
	
	for (i = 0; i < limit; i++) {
		if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
			return jack_port_new (client, port[i].id,
					      client->engine);
		}
	}

	return NULL;
}
Пример #5
0
jack_port_t *
jack_port_by_id_int (const jack_client_t *client, jack_port_id_t id, int* free)
{
	JSList *node;

	for (node = client->ports; node; node = jack_slist_next (node)) {
		if (((jack_port_t *) node->data)->shared->id == id) {
			*free = FALSE;
			return (jack_port_t *) node->data;
		}
	}

	if (id >= client->engine->port_max)
		return NULL;

	if (client->engine->ports[id].in_use) {
		*free = TRUE;
		return jack_port_new (client, id, client->engine);
	}

	return NULL;
}