diff --git a/example-clients/simple_client.c b/example-clients/simple_client.c index 2ab8328..3190285 100644 --- a/example-clients/simple_client.c +++ b/example-clients/simple_client.c @@ -21,33 +21,34 @@ jack_client_t *client; * special realtime thread once for each audio cycle. * * This client does nothing more than copy data from its input - * port to its output port. It will exit when stopped by + * port to its output port. It will exit when stopped by * the user (e.g. using Ctrl-C on a unix-ish operating system) */ int process (jack_nframes_t nframes, void *arg) { jack_default_audio_sample_t *in, *out; - + in = jack_port_get_buffer (input_port, nframes); out = jack_port_get_buffer (output_port, nframes); memcpy (out, in, sizeof (jack_default_audio_sample_t) * nframes); - return 0; + return 0; } -char *session_callback( jack_session_event_t code, const char *path, const char *prefix, void *arg ) +char * +session_callback (jack_session_event_t code, const char *path, const char *uuid, void *arg) { char retval[100]; - printf( "session notification\n" ); - printf( "path %s, prefix %s, type: %s\n", path, prefix, code == JackSessionSave ? "save" : "quit" ); + printf ("session notification\n"); + printf ("path %s, uuid %s, type: %s\n", path, uuid, code == JackSessionSave ? "save" : "quit"); - if( code == JackSessionQuit ) - exit(1); + if (code == JackSessionQuit) + exit (1); - snprintf( retval, 100, "jack_simple_client %s", prefix ); - return strdup( retval ); + snprintf (retval, 100, "jack_simple_client %s", uuid); + return strdup (retval); } /** @@ -68,7 +69,7 @@ main (int argc, char *argv[]) const char *server_name = NULL; jack_options_t options = JackNullOption; jack_status_t status; - + /* open a client connection to the JACK server */ if( argc == 1 ) @@ -96,8 +97,8 @@ main (int argc, char *argv[]) there is work to be done. */ - jack_client_set_cookie( client, "info", "simple" ); - jack_client_set_cookie( client, "info2", "no" ); + jack_client_set_cookie (client, "info", "simple"); + jack_client_set_cookie (client, "info2", "no"); jack_set_process_callback (client, process, 0); /* tell the JACK server to call `jack_shutdown()' if @@ -107,8 +108,13 @@ main (int argc, char *argv[]) jack_on_shutdown (client, jack_shutdown, 0); - jack_set_session_callback( client, session_callback, NULL ); - /* display the current sample rate. + /* tell the JACK server to call `session_callback()' if + the session is saved. + */ + + jack_set_session_callback (client, session_callback, NULL); + + /* display the current sample rate. */ printf ("engine sample rate: %" PRIu32 "\n", @@ -156,7 +162,7 @@ main (int argc, char *argv[]) } free (ports); - + ports = jack_get_ports (client, NULL, NULL, JackPortIsPhysical|JackPortIsInput); if (ports == NULL) { diff --git a/jack/types.h b/jack/types.h index 6ef9312..078de85 100644 --- a/jack/types.h +++ b/jack/types.h @@ -365,7 +365,7 @@ typedef void (*JackShutdownCallback)(void *arg); * to release client ressources. Warning: jack_client_close() cannot be * safely used inside the shutdown callback and has to be called outside of * the callback context. - + * * @param code a shuntdown code * @param reason a string discribing the shuntdown reason (backend failure, server crash... etc...) * @param arg pointer to a client supplied structure @@ -382,16 +382,14 @@ typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, * the prefix also acts as uuid, which the client needs to specify * to jack_client_open() upon session reload. * - * the return value is a commandline, which will restore the state. + * The return value is a commandline, which will restore the state. * - * @param code the type of the Event (Save or Quit) * @param session_dir with trailing separator. - * @param prefix for saved files. + * @param prefix for saved files. * @param arg pointer to a client supplied structure */ - -typedef char *(*JackSessionCallback)(jack_session_event_t code, const char* session_dir, const char* prefix, void *arg); +typedef char *(*JackSessionCallback)(jack_session_event_t code, const char* session_dir, const char* uuid, void *arg); /** * Used for the type argument of jack_port_register() for default diff --git a/libjack/client.c b/libjack/client.c index 1633ea5..49b081a 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -2531,6 +2531,7 @@ jack_set_session_callback(jack_client_t* client, JackSessionCallback callback, v client->control->session_cbset = (callback != NULL); return 0; } + int jack_get_process_done_fd (jack_client_t *client) {