Re: [LAU] persisting jack_connect problem

From: Cedric Roux <sed@email-addr-hidden>
Date: Mon Mar 28 2011 - 11:53:06 EEST

----- "Julien Claassen" <julien@email-addr-hidden-lab.de> wrote:

> Hello Cedric!
> I just changed it to int volatile done = 0 and added some debugging
> output.
> It jumps into the connecting branch (if(connect) ), then there's
> the
> expression:
> if (jack_connect(client, jack_port_name(src_port),...
> There it fails (i.e., it doesn't execute the following goto exit.
> Instead,
> it executed my prepare else and then hung around the while-loop
> forever. Well,
> I didn't wait that long. :-)
> So any thoughts on that?
> Warmly yours
> Julien

Julien,

add the lines:
        /* tell the JACK server that we are ready to roll */
        if (jack_activate (client)) {
                fprintf (stderr, "cannot activate client");
                goto exit;
        }

just before the lines:
        /* connect the ports. Note: you can't do this before
           the client is activated (this may change in the future).
        */

        if (connecting) {

and add:
    jack_deactivate (client);

just after the lines:
    // Wait for connection/disconnection to be effective
    while(!done) {
    #ifdef WIN32
        Sleep(10);
    #else
        usleep(10000);
    #endif
    }

that does the trick for me.

You should keep the "volatile" stuff. Without it the program
may loop forever if compiled with gcc and some optimization.

Note: it is normal that it doesn't jump to exit. Go read the
sources of jack-1.9.6, it's clearer. It jumps to exit in case
of error. It should do the while(!done) if things are alright.
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Mon Mar 28 12:15:03 2011

This archive was generated by hypermail 2.1.8 : Mon Mar 28 2011 - 12:15:04 EEST