[LAU] persisting jack_connect problem

Stéphane Letz letz at grame.fr
Mon Mar 28 09:33:03 UTC 2011


Le 28 mars 2011 à 10:53, Cedric Roux a écrit :

> 
> ----- "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.

OK commited those changes in JACK2 SVN 4223 

Stéphane 


More information about the Linux-audio-user mailing list