Skip to content
Permalink
Browse files

basics for a hypothetical PortRename callback

This cannot be implemented at present because jack_port_set_name() does not take
a jack_client_t* as an argument, and thus no msg can be sent to the server
regarding the name change. Jack2 accomplishes this by walking its static array
of clients to find one that is in use and sends the msg using that one. This
is not possible in Jack1 because we do not use static arrays of clients (or
ports).
  • Loading branch information
pauldavisthefirst committed Oct 12, 2013
1 parent 16193a3 commit 94c819accfab2612050e875c24cf325daa0fd26d
Showing with 11 additions and 2 deletions.
  1. +4 −1 include/internal.h
  2. +4 −0 libjack/client.c
  3. +2 −0 libjack/local.h
  4. +1 −1 libjack/port.c
@@ -223,7 +223,8 @@ typedef enum {
ClientUnregistered,
SaveSession,
LatencyCallback,
PropertyChange
PropertyChange,
PortRename
} JackEventType;

const char* jack_event_type_name (JackEventType);
@@ -244,6 +245,7 @@ typedef struct {
uint32_t key_size; /* key data will follow the event structure */
} y;
union {
char other_name[JACK_PORT_NAME_SIZE];
jack_property_change_t property_change;
} z;
} POST_PACKED_STRUCTURE jack_event_t;
@@ -309,6 +311,7 @@ typedef volatile struct {
volatile uint8_t session_cbset;
volatile uint8_t latency_cbset;
volatile uint8_t property_cbset;
volatile uint8_t port_rename_cbset;

} POST_PACKED_STRUCTURE jack_client_control_t;

@@ -1853,6 +1853,10 @@ jack_client_process_events (jack_client_t* client)
if (key) {
free (key);
}
case PortRename:
if (control->port_rename_cbset) {
client->port_rename_cb (event.y.other_id, event.x.name, event.z.other_name, client->port_rename_cb_arg);
}
break;
}

@@ -79,6 +79,8 @@ struct _jack_client {
void *latency_cb_arg;
JackPropertyChangeCallback property_cb;
void *property_cb_arg;
JackPortRenameCallback port_rename_cb;
void *port_rename_cb_arg;

/* external clients: set by libjack
* internal clients: set by engine */
@@ -809,7 +809,7 @@ jack_port_set_name (jack_port_t *port, const char *new_name)
len = sizeof (port->shared->name) -
((int) (colon - port->shared->name)) - 2;
snprintf (colon+1, len, "%s", new_name);
return 0;
}

0 comments on commit 94c819a

Please sign in to comment.
You can’t perform that action at this time.