Browse Source

Tidy-up-session-stuff-nitpicks-for-upstream by drobilla

tags/0.120.1
Torben Hohn 15 years ago
parent
commit
433e55a10b
3 changed files with 27 additions and 22 deletions
  1. +22
    -16
      example-clients/simple_client.c
  2. +4
    -6
      jack/types.h
  3. +1
    -0
      libjack/client.c

+ 22
- 16
example-clients/simple_client.c View File

@@ -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) {


+ 4
- 6
jack/types.h View File

@@ -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


+ 1
- 0
libjack/client.c View File

@@ -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)
{


Loading…
Cancel
Save