Commit 9fe49767 authored by sletz's avatar sletz
Browse files

Correction of jack_connect/jack_disconnect: use of jack_activate and volatile...

Correction of jack_connect/jack_disconnect: use of jack_activate and volatile keyword for thread shared variable.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4223 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 64117951
......@@ -34,6 +34,10 @@ Valerio Pilo
Jackdmp changes log
---------------------------
2011-03-28 Stephane Letz <letz@grame.fr>
* Correction of jack_connect/jack_disconnect: use of jack_activate and volatile keyword for thread shared variable.
2011-03-24 Stephane Letz <letz@grame.fr>
* Implement renaming in JackDriver::Open to avoid name collision (thanks Devin Anderson).
......
......@@ -153,8 +153,7 @@ namespace Jack
}
//port = fGraphManager->GetPort ( port_id );
netj.capture_ports =
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
netj.capture_ports = jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
if( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT
......@@ -202,8 +201,7 @@ namespace Jack
}
//port = fGraphManager->GetPort ( port_id );
netj.playback_ports =
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
netj.playback_ports = jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
if( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT
......
......@@ -31,7 +31,7 @@
jack_port_t *input_port;
jack_port_t *output_port;
int connecting, disconnecting;
int done = 0;
volatile int done = 0;
#define TRUE 1
#define FALSE 0
......@@ -58,7 +58,6 @@ show_usage (char *my_name)
fprintf (stderr, "For more information see http://jackaudio.org/\n");
}
int
main (int argc, char *argv[])
{
......@@ -181,11 +180,11 @@ main (int argc, char *argv[])
if ((port1 = jack_port_by_name(client, portA)) == 0) {
fprintf (stderr, "ERROR %s not a valid port\n", portA);
goto exit;
}
}
if ((port2 = jack_port_by_name(client, portB)) == 0) {
fprintf (stderr, "ERROR %s not a valid port\n", portB);
goto exit;
}
}
port1_flags = jack_port_flags (port1);
port2_flags = jack_port_flags (port2);
......@@ -207,17 +206,25 @@ main (int argc, char *argv[])
goto exit;
}
/* tell the JACK server that we are ready to roll */
if (jack_activate (client)) {
fprintf (stderr, "cannot activate client");
goto exit;
}
/* connect the ports. Note: you can't do this before
the client is activated (this may change in the future).
*/
if (connecting) {
if (jack_connect(client, jack_port_name(src_port), jack_port_name(dst_port))) {
fprintf (stderr, "cannot connect client, already connected?\n");
goto exit;
}
}
if (disconnecting) {
if (jack_disconnect(client, jack_port_name(src_port), jack_port_name(dst_port))) {
fprintf (stderr, "cannot disconnect client, already disconnected?\n");
goto exit;
}
}
......
/** @file simple_client.c
/** @file control.c
*
* @brief This simple client demonstrates the basic features of JACK
* as they would be used by many applications.
......@@ -14,14 +14,14 @@
jack_client_t *client;
static int reorder = 0;
static int Jack_Graph_Order_Callback(void *arg)
{
const char **ports;
int i;
printf("Jack_Graph_Order_Callback count = %d\n", reorder++);
ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput);
if (ports) {
for (i = 0; ports[i]; ++i) {
......@@ -29,15 +29,15 @@ static int Jack_Graph_Order_Callback(void *arg)
}
free(ports);
}
ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsInput);
if (ports) {
if (ports) {
for (i = 0; ports[i]; ++i) {
printf("name: %s\n", ports[i]);
}
free(ports);
}
return 0;
}
......@@ -46,7 +46,7 @@ main (int argc, char *argv[])
{
jack_options_t options = JackNullOption;
jack_status_t status;
/* open a client connection to the JACK server */
client = jack_client_open("control_client", options, &status);
......@@ -54,7 +54,7 @@ main (int argc, char *argv[])
printf("jack_client_open() failed \n");
exit(1);
}
if (jack_set_graph_order_callback(client, Jack_Graph_Order_Callback, 0) != 0) {
printf("Error when calling jack_set_graph_order_callback() !\n");
}
......@@ -66,10 +66,10 @@ main (int argc, char *argv[])
printf("cannot activate client");
exit(1);
}
printf("Type 'q' to quit\n");
printf("Type 'q' to quit\n");
while ((getchar() != 'q')) {}
jack_client_close(client);
exit (0);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment