From 31a0a616951fee8b862443dea2b91a50b95b238f Mon Sep 17 00:00:00 2001 From: torben Date: Sat, 27 Mar 2010 17:02:15 +0000 Subject: [PATCH] fix simple_session_client providing wrong commandline. git-svn-id: svn+ssh://jackaudio.org/trunk/jack@3974 0c269be4-1314-0410-8aa9-9f06e86f4224 --- example-clients/simple_session_client.c | 46 +++++++++++++++---------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/example-clients/simple_session_client.c b/example-clients/simple_session_client.c index 76b0cc9..169267e 100644 --- a/example-clients/simple_session_client.c +++ b/example-clients/simple_session_client.c @@ -49,7 +49,7 @@ session_callback (jack_session_event_t *event, void *arg) printf ("path %s, uuid %s, type: %s\n", event->session_dir, event->client_uuid, event->type == JackSessionSave ? "save" : "quit"); - snprintf (retval, 100, "jack_simple_client %s", event->client_uuid); + snprintf (retval, 100, "jack_simple_session_client %s", event->client_uuid); event->command_line = strdup (retval); jack_session_reply( client, event ); @@ -156,31 +156,39 @@ main (int argc, char *argv[]) * it. */ - ports = jack_get_ports (client, NULL, NULL, + + /* only do the autoconnect when not reloading from a session. + * in case of a session reload, the SM will restore our connections + */ + + if (argc==1) { + + ports = jack_get_ports (client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput); - if (ports == NULL) { - fprintf(stderr, "no physical capture ports\n"); - exit (1); - } + if (ports == NULL) { + fprintf(stderr, "no physical capture ports\n"); + exit (1); + } - if (jack_connect (client, ports[0], jack_port_name (input_port))) { - fprintf (stderr, "cannot connect input ports\n"); - } + if (jack_connect (client, ports[0], jack_port_name (input_port))) { + fprintf (stderr, "cannot connect input ports\n"); + } - free (ports); + free (ports); - ports = jack_get_ports (client, NULL, NULL, + ports = jack_get_ports (client, NULL, NULL, JackPortIsPhysical|JackPortIsInput); - if (ports == NULL) { - fprintf(stderr, "no physical playback ports\n"); - exit (1); - } + if (ports == NULL) { + fprintf(stderr, "no physical playback ports\n"); + exit (1); + } - if (jack_connect (client, jack_port_name (output_port), ports[0])) { - fprintf (stderr, "cannot connect output ports\n"); - } + if (jack_connect (client, jack_port_name (output_port), ports[0])) { + fprintf (stderr, "cannot connect output ports\n"); + } - free (ports); + free (ports); + } /* keep running until until we get a quit event */