Browse Source

Implement new jack_port_rename API

tags/v1.9.11-RC1
falkTX 9 years ago
parent
commit
fc6344e5f2
3 changed files with 42 additions and 12 deletions
  1. +25
    -11
      common/JackAPI.cpp
  2. +1
    -0
      common/JackWeakAPI.c
  3. +16
    -1
      common/jack/jack.h

+ 25
- 11
common/JackAPI.cpp View File

@@ -159,6 +159,7 @@ extern "C"
LIB_EXPORT int jack_recompute_total_latencies(jack_client_t*); LIB_EXPORT int jack_recompute_total_latencies(jack_client_t*);


LIB_EXPORT int jack_port_set_name(jack_port_t *port, const char* port_name); LIB_EXPORT int jack_port_set_name(jack_port_t *port, const char* port_name);
LIB_EXPORT int jack_port_rename(jack_client_t *client, jack_port_t *port, const char* port_name);
LIB_EXPORT int jack_port_set_alias(jack_port_t *port, const char* alias); LIB_EXPORT int jack_port_set_alias(jack_port_t *port, const char* alias);
LIB_EXPORT int jack_port_unset_alias(jack_port_t *port, const char* alias); LIB_EXPORT int jack_port_unset_alias(jack_port_t *port, const char* alias);
LIB_EXPORT int jack_port_get_aliases(const jack_port_t *port, char* const aliases[2]); LIB_EXPORT int jack_port_get_aliases(const jack_port_t *port, char* const aliases[2]);
@@ -635,24 +636,37 @@ LIB_EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client)
LIB_EXPORT int jack_port_set_name(jack_port_t* port, const char* name) LIB_EXPORT int jack_port_set_name(jack_port_t* port, const char* name)
{ {
JackGlobals::CheckContext("jack_port_set_name"); JackGlobals::CheckContext("jack_port_set_name");
jack_error("jack_port_set_name: deprecated");


// Find a valid client
jack_client_t* client = NULL;
for (int i = 0; i < CLIENT_NUM; i++) {
if ((client = (jack_client_t*)JackGlobals::fClientTable[i])) {
break;
}
}

return (client) ? jack_port_rename(client, port, name) : -1;
}

LIB_EXPORT int jack_port_rename(jack_client_t* ext_client, jack_port_t* port, const char* name)
{
JackGlobals::CheckContext("jack_port_rename");

JackClient* client = (JackClient*)ext_client;
uintptr_t port_aux = (uintptr_t)port; uintptr_t port_aux = (uintptr_t)port;
jack_port_id_t myport = (jack_port_id_t)port_aux; jack_port_id_t myport = (jack_port_id_t)port_aux;
if (!CheckPort(myport)) {
jack_error("jack_port_set_name called with an incorrect port %ld", myport);
if (client == NULL) {
jack_error("jack_port_rename called with a NULL client");
return -1;
} else if (!CheckPort(myport)) {
jack_error("jack_port_rename called with an incorrect port %ld", myport);
return -1; return -1;
} else if (name == NULL) { } else if (name == NULL) {
jack_error("jack_port_set_name called with a NULL port name");
jack_error("jack_port_rename called with a NULL port name");
return -1; return -1;
} else { } else {
JackClient* client = NULL;
for (int i = 0; i < CLIENT_NUM; i++) {
// Find a valid client
if ((client = JackGlobals::fClientTable[i])) {
break;
}
}
return (client) ? client->PortRename(myport, name) : -1;
client->PortRename(myport, name);
} }
} }




+ 1
- 0
common/JackWeakAPI.c View File

@@ -207,6 +207,7 @@ DECL_VOID_FUNCTION(jack_port_set_latency_range, (jack_port_t *port, jack_latency
DECL_FUNCTION(int, jack_recompute_total_latencies, (jack_client_t* client),(client)); DECL_FUNCTION(int, jack_recompute_total_latencies, (jack_client_t* client),(client));


DECL_FUNCTION(int, jack_port_set_name, (jack_port_t *port, const char *port_name), (port, port_name)); DECL_FUNCTION(int, jack_port_set_name, (jack_port_t *port, const char *port_name), (port, port_name));
DECL_FUNCTION(int, jack_port_rename, (jack_client_t *client, jack_port_t *port, const char *port_name), (client, port, port_name));
DECL_FUNCTION(int, jack_port_set_alias, (jack_port_t *port, const char *alias), (port, alias)); DECL_FUNCTION(int, jack_port_set_alias, (jack_port_t *port, const char *alias), (port, alias));
DECL_FUNCTION(int, jack_port_unset_alias, (jack_port_t *port, const char *alias), (port, alias)); DECL_FUNCTION(int, jack_port_unset_alias, (jack_port_t *port, const char *alias), (port, alias));
DECL_FUNCTION(int, jack_port_get_aliases, (const jack_port_t *port, char* const aliases[2]), (port,aliases)); DECL_FUNCTION(int, jack_port_get_aliases, (const jack_port_t *port, char* const aliases[2]), (port,aliases));


+ 16
- 1
common/jack/jack.h View File

@@ -887,13 +887,28 @@ int jack_port_tie (jack_port_t *src, jack_port_t *dst) JACK_OPTIONAL_WEAK_DEPREC
int jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; int jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;


/** /**
* \bold THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
* NEW JACK CLIENTS
*
* Modify a port's short name. May be called at any time. If the * Modify a port's short name. May be called at any time. If the
* resulting full name (including the @a "client_name:" prefix) is * resulting full name (including the @a "client_name:" prefix) is
* longer than jack_port_name_size(), it will be truncated. * longer than jack_port_name_size(), it will be truncated.
* *
* @return 0 on success, otherwise a non-zero error code. * @return 0 on success, otherwise a non-zero error code.
*/ */
int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;

/**
* Modify a port's short name. May NOT be called from a callback handling a server event.
* If the resulting full name (including the @a "client_name:" prefix) is
* longer than jack_port_name_size(), it will be truncated.
*
* @return 0 on success, otherwise a non-zero error code.
*
* This differs from jack_port_set_name() by triggering PortRename notifications to
* clients that have registered a port rename handler.
*/
int jack_port_rename (jack_client_t* client, jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;


/** /**
* Set @a alias as an alias for @a port. May be called at any time. * Set @a alias as an alias for @a port. May be called at any time.


Loading…
Cancel
Save