bump micro version
[jack.git] / tools / evmon.c
blob32b997853051e320380367084a4f29d51beba579
1 /*
2 Copyright (C) 2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include <stdio.h>
20 #include <errno.h>
21 #include <unistd.h>
22 #include <string.h>
23 #include <stdlib.h>
25 #include <jack/jack.h>
27 void
28 port_callback (jack_port_id_t port, int yn, void* arg)
30 printf ("Port %d %s\n", port, (yn ? "registered" : "unregistered"));
33 void
34 connect_callback (jack_port_id_t a, jack_port_id_t b, int yn, void* arg)
36 printf ("Ports %d and %d %s\n", a, b, (yn ? "connected" : "disconnected"));
39 void
40 client_callback (const char* client, int yn, void* arg)
42 printf ("Client %s %s\n", client, (yn ? "registered" : "unregistered"));
45 int
46 graph_callback (void* arg)
48 printf ("Graph reordered\n");
49 return 0;
52 int
53 main (int argc, char *argv[])
55 jack_client_t *client;
56 jack_options_t options = JackNullOption;
57 jack_status_t status;
59 if ((client = jack_client_open ("event-monitor", options, &status, NULL)) == 0) {
60 fprintf (stderr, "jack_client_open() failed, "
61 "status = 0x%2.0x\n", status);
62 if (status & JackServerFailed) {
63 fprintf (stderr, "Unable to connect to JACK server\n");
65 return 1;
68 if (jack_set_port_registration_callback (client, port_callback, NULL)) {
69 fprintf (stderr, "cannot set port registration callback\n");
70 return 1;
72 if (jack_set_port_connect_callback (client, connect_callback, NULL)) {
73 fprintf (stderr, "cannot set port connect callback\n");
74 return 1;
76 if (jack_set_client_registration_callback (client, client_callback, NULL)) {
77 fprintf (stderr, "cannot set client registration callback\n");
78 return 1;
80 if (jack_set_graph_order_callback (client, graph_callback, NULL)) {
81 fprintf (stderr, "cannot set graph order registration callback\n");
82 return 1;
84 if (jack_activate (client)) {
85 fprintf (stderr, "cannot activate client");
86 return 1;
89 sleep (-1);
90 exit (0);