16 //fprintf (stderr, "%s: JACK Audio Connection Kit version " VERSION "\n",
24 fprintf (stderr
, "\nUsage: %s [options]\n", my_name
);
25 fprintf (stderr
, "List active Jack ports, and optionally display extra information.\n\n");
26 fprintf (stderr
, "Display options:\n");
27 fprintf (stderr
, " -c, --connections List connections to/from each port\n");
28 fprintf (stderr
, " -l, --latency Display per-port latency in frames at each port\n");
29 fprintf (stderr
, " -L, --latency Display total latency in frames at each port\n");
30 fprintf (stderr
, " -p, --properties Display port properties. Output may include:\n"
31 " input|output, can-monitor, physical, terminal\n\n");
32 fprintf (stderr
, " -t, --type Display port type\n");
33 fprintf (stderr
, " -h, --help Display this help message\n");
34 fprintf (stderr
, " --version Output version information and exit\n\n");
35 fprintf (stderr
, "For more information see http://jackit.sourceforge.net/\n");
39 main (int argc
, char *argv
[])
41 jack_client_t
*client
;
43 const char **ports
, **connections
;
46 int show_port_latency
= 0;
47 int show_total_latency
= 0;
48 int show_properties
= 0;
54 struct option long_options
[] = {
55 { "connections", 0, 0, 'c' },
56 { "port-latency", 0, 0, 'l' },
57 { "total-latency", 0, 0, 'L' },
58 { "properties", 0, 0, 'p' },
59 { "type", 0, 0, 't' },
60 { "help", 0, 0, 'h' },
61 { "version", 0, 0, 'v' },
65 my_name
= strrchr(argv
[0], '/');
72 while ((c
= getopt_long (argc
, argv
, "clLphvt", long_options
, &option_index
)) >= 0) {
78 show_port_latency
= 1;
81 show_total_latency
= 1;
104 /* Open a client connection to the JACK server. Starting a
105 * new server only to list its ports seems pointless, so we
106 * specify JackNoStartServer. */
107 //JOQ: need a new server name option
109 client
= jack_client_open ("lsp", JackNoStartServer
, &status
);
110 if (client
== NULL
) {
111 if (status
& JackServerFailed
) {
112 fprintf (stderr
, "JACK server not running\n");
114 fprintf (stderr
, "jack_client_open() failed, "
115 "status = 0x%2.0x\n", status
);
120 ports
= jack_get_ports (client
, NULL
, NULL
, 0);
122 for (i
= 0; ports
[i
]; ++i
) {
123 printf ("%s\n", ports
[i
]);
125 port
= jack_port_by_name (client
, ports
[i
]);
128 if ((connections
= jack_port_get_all_connections (client
, jack_port_by_name(client
, ports
[i
]))) != 0) {
129 for (j
= 0; connections
[j
]; j
++) {
130 printf (" %s\n", connections
[j
]);
135 if (show_port_latency
) {
137 printf (" port latency = %ld frames\n",
138 jack_port_get_latency (port
));
141 if (show_total_latency
) {
143 printf (" total latency = %ld frames\n",
144 jack_port_get_total_latency (client
, port
));
147 if (show_properties
) {
149 int flags
= jack_port_flags (port
);
150 printf (" properties: ");
151 if (flags
& JackPortIsInput
) {
152 fputs ("input,", stdout
);
154 if (flags
& JackPortIsOutput
) {
155 fputs ("output,", stdout
);
157 if (flags
& JackPortCanMonitor
) {
158 fputs ("can-monitor,", stdout
);
160 if (flags
& JackPortIsPhysical
) {
161 fputs ("physical,", stdout
);
163 if (flags
& JackPortIsTerminal
) {
164 fputs ("terminal,", stdout
);
172 fputs (jack_port_type (port
), stdout
);
177 jack_client_close (client
);