Browse Source

Cleanup

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1676 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.68
sletz 18 years ago
parent
commit
2890578119
2 changed files with 8 additions and 23 deletions
  1. +8
    -22
      example-clients/connect.c
  2. +0
    -1
      example-clients/freewheel.c

+ 8
- 22
example-clients/connect.c View File

@@ -36,7 +36,6 @@ int connecting, disconnecting;


int int
main (int argc, char *argv[]) main (int argc, char *argv[])

{ {
jack_client_t* client = NULL; jack_client_t* client = NULL;
char *my_name = strrchr(argv[0], '/'); char *my_name = strrchr(argv[0], '/');
@@ -56,8 +55,7 @@ main (int argc, char *argv[])
connecting = TRUE; connecting = TRUE;
} else { } else {
fprintf(stderr, "ERROR! client should be called jack_connect or jack_disconnect. client is called %s\n", my_name); fprintf(stderr, "ERROR! client should be called jack_connect or jack_disconnect. client is called %s\n", my_name);
//return 1;
goto error;
return 1;
} }
printf("connecting %ld\n",connecting); printf("connecting %ld\n",connecting);
@@ -66,16 +64,14 @@ main (int argc, char *argv[])
fprintf (stderr, "usage: %s <src_port> <dst_port>\n", my_name); fprintf (stderr, "usage: %s <src_port> <dst_port>\n", my_name);
fprintf(stderr, "The source port must be an output port of the source client.\n"); fprintf(stderr, "The source port must be an output port of the source client.\n");
fprintf (stderr, "The destination port must be an input port of the destination client.\n"); fprintf (stderr, "The destination port must be an input port of the destination client.\n");
//return 1;
goto error;
return 1;
} }


/* try to become a client of the JACK server */ /* try to become a client of the JACK server */


if ((client = jack_client_new (my_name)) == 0) { if ((client = jack_client_new (my_name)) == 0) {
fprintf (stderr, "jack server not running?\n"); fprintf (stderr, "jack server not running?\n");
//return 1;
goto error;
return 1;
} }


/* display the current sample rate. once the client is activated /* display the current sample rate. once the client is activated
@@ -83,8 +79,6 @@ main (int argc, char *argv[])
callback (see above) for this value. callback (see above) for this value.
*/ */


// printf ("engine sample rate: %" PRIu32 "\n",jack_get_sample_rate (client));

/* find the two ports */ /* find the two ports */


if ((input_port = jack_port_by_name(client, argv[1])) == 0) { if ((input_port = jack_port_by_name(client, argv[1])) == 0) {
@@ -107,33 +101,25 @@ main (int argc, char *argv[])
the client is activated (this may change in the future). the client is activated (this may change in the future).
*/ */


/* jack_port_connect not yet implemented
if (jack_port_connect(client, input_port, output_port)) {
fprintf (stderr, "cannot connect ports\n");
}
*/
if (connecting) {
printf("connecting %s %s\n",jack_port_name(input_port), jack_port_name(output_port));
if (connecting) {
if (jack_connect(client, jack_port_name(input_port), jack_port_name(output_port))) { if (jack_connect(client, jack_port_name(input_port), jack_port_name(output_port))) {
fprintf (stderr, "cannot connect ports\n"); fprintf (stderr, "cannot connect ports\n");
goto error; goto error;
} }
} }
if (disconnecting) { if (disconnecting) {
printf("disconnecting %s %s\n",jack_port_name(input_port), jack_port_name(output_port));
if (jack_disconnect(client, jack_port_name(input_port), jack_port_name(output_port))) {
if (jack_disconnect(client, jack_port_name(input_port), jack_port_name(output_port))) {
fprintf (stderr, "cannot disconnect ports\n"); fprintf (stderr, "cannot disconnect ports\n");
goto error; goto error;
} }
} }
//jack_deactivate (client);
jack_deactivate (client);
jack_client_close (client); jack_client_close (client);
return 0; return 0;
error: error:
if (client) jack_client_close (client);
if (client)
jack_client_close (client);
return 1; return 1;
} }



+ 0
- 1
example-clients/freewheel.c View File

@@ -81,6 +81,5 @@ main (int argc, char *argv[])
} }


jack_client_close(client); jack_client_close(client);

return 0; return 0;
} }

Loading…
Cancel
Save