Correct JackPortAudioDriver.
[jack2.git] / example-clients / control.c
blob619693ec295f1d9b9ca8390ce6cb1fa6b4c0d69f
1 /** @file control.c
3 * @brief This simple client demonstrates the basic features of JACK
4 * as they would be used by many applications.
5 */
7 #include <stdio.h>
8 #include <errno.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <signal.h>
12 #include <math.h>
13 #include <jack/jack.h>
15 jack_client_t *client;
16 static int reorder = 0;
18 static int Jack_Graph_Order_Callback(void *arg)
20 const char **ports;
21 int i;
23 printf("Jack_Graph_Order_Callback count = %d\n", reorder++);
25 ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput);
26 if (ports) {
27 for (i = 0; ports[i]; ++i) {
28 printf("name: %s\n", ports[i]);
30 jack_free(ports);
33 ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsInput);
34 if (ports) {
35 for (i = 0; ports[i]; ++i) {
36 printf("name: %s\n", ports[i]);
38 jack_free(ports);
41 return 0;
44 int
45 main (int argc, char *argv[])
47 jack_options_t options = JackNullOption;
48 jack_status_t status;
50 /* open a client connection to the JACK server */
52 client = jack_client_open("control_client", options, &status);
53 if (client == NULL) {
54 printf("jack_client_open() failed \n");
55 exit(1);
58 if (jack_set_graph_order_callback(client, Jack_Graph_Order_Callback, 0) != 0) {
59 printf("Error when calling jack_set_graph_order_callback() !\n");
62 /* Tell the JACK server that we are ready to roll. Our
63 * process() callback will start running now. */
65 if (jack_activate(client)) {
66 printf("cannot activate client");
67 exit(1);
70 printf("Type 'q' to quit\n");
71 while ((getchar() != 'q')) {}
73 jack_client_close(client);
74 exit (0);