[LAU] persisting jack_connect problem

Cedric Roux sed at free.fr
Mon Mar 28 08:53:06 UTC 2011


----- "Julien Claassen" <julien at c-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.


More information about the Linux-audio-user mailing list