14 #include <jack/jack.h>
17 jack_client_t
*client
;
19 static void signal_handler ( int sig
)
21 jack_client_close ( client
);
22 fprintf ( stderr
, "signal received, exiting ...\n" );
28 * JACK calls this shutdown_callback if the server ever shuts down or
29 * decides to disconnect the client.
32 jack_shutdown ( void *arg
)
38 main ( int argc
, char *argv
[] )
40 jack_options_t options
= JackNullOption
;
43 /* open a client connection to the JACK server */
45 client
= jack_client_open ("jack_cpu_load", options
, &status
);
48 fprintf ( stderr
, "jack_client_open() failed, "
49 "status = 0x%2.0x\n", status
);
50 if ( status
& JackServerFailed
)
52 fprintf ( stderr
, "Unable to connect to JACK server\n" );
57 jack_on_shutdown ( client
, jack_shutdown
, 0 );
59 /* Tell the JACK server that we are ready to roll. Our
60 * process() callback will start running now. */
62 if ( jack_activate ( client
) )
64 fprintf ( stderr
, "cannot activate client" );
68 /* install a signal handler to properly quits jack client */
70 signal ( SIGINT
, signal_handler
);
71 signal ( SIGABRT
, signal_handler
);
72 signal ( SIGTERM
, signal_handler
);
74 signal ( SIGQUIT
, signal_handler
);
75 signal ( SIGTERM
, signal_handler
);
76 signal ( SIGHUP
, signal_handler
);
77 signal ( SIGINT
, signal_handler
);
82 printf("jack DSP load %f\n", jack_cpu_load(client
));
90 jack_client_close ( client
);