jack_set_port_connect_callback and counting connections

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

jack_set_port_connect_callback and counting connections

ondrej par
Hi all,

it seems that when a JackPortConnectCallback is set up,
jack_port_connected gives strange results. The following code prints
"connected 2 times" if the (dummy) callback is registered, and prints
"connected 1 times" if the jack_set_port_connect_callback is commented
out:

#include <stdio.h>
#include <jack/jack.h>

void portConnectCallback(jack_port_id_t ida, jack_port_id_t idb, int
c, void* arg) {}

int main(int argc, char**argv) {
        jack_client_t* client = jack_client_open("testclient",
JackNullOption, NULL);
        jack_port_t* in = jack_port_register(client, "in",
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
        jack_port_t* out = jack_port_register(client, "out",
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
        jack_set_port_connect_callback(client, portConnectCallback, NULL);
        jack_activate(client);
        jack_connect(client, "testclient:out", "testclient:in");

        printf("connected %d times\n", jack_port_connected(out));
}

Also, the jack_port_get_connections report the connection twice.

Thanks for reply,
O.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: jack_set_port_connect_callback and counting connections

Stéphane Letz

Le 5 mars 08 à 03:11, ondrej par a écrit :

> Hi all,
>
> it seems that when a JackPortConnectCallback is set up,
> jack_port_connected gives strange results. The following code prints
> "connected 2 times" if the (dummy) callback is registered, and prints
> "connected 1 times" if the jack_set_port_connect_callback is commented
> out:
>
> #include <stdio.h>
> #include <jack/jack.h>
>
> void portConnectCallback(jack_port_id_t ida, jack_port_id_t idb, int
> c, void* arg) {}
>
> int main(int argc, char**argv) {
>        jack_client_t* client = jack_client_open("testclient",
> JackNullOption, NULL);
>        jack_port_t* in = jack_port_register(client, "in",
> JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
>        jack_port_t* out = jack_port_register(client, "out",
> JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
>        jack_set_port_connect_callback(client, portConnectCallback,  
> NULL);
>        jack_activate(client);
>        jack_connect(client, "testclient:out", "testclient:in");
>
>        printf("connected %d times\n", jack_port_connected(out));
> }
>
> Also, the jack_port_get_connections report the connection twice.
>
> Thanks for reply,
> O.
>

Yes, bug confirmed on SVN 0.109.4 with the bit more expanded version:

#include <stdio.h>
#include <jack/jack.h>

void portConnectCallback(jack_port_id_t ida, jack_port_id_t idb, int  
c, void* arg)
{
        printf("portConnectCallback src = %ld dst = %ld \n", ida, idb);
}

int main(int argc, char**argv)
{
        jack_client_t* client = jack_client_open("testclient",  
JackNullOption, NULL);
        jack_port_t* in = jack_port_register(client, "in",  
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
        jack_port_t* out = jack_port_register(client, "out",  
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
        jack_set_port_connect_callback(client, portConnectCallback, NULL);
        jack_activate(client);
        jack_connect(client, "testclient:out", "testclient:in");
        printf("connected %d times\n", jack_port_connected(out));
        sleep(2);
        jack_disconnect(client, "testclient:out", "testclient:in");
        printf("connected %d times\n", jack_port_connected(out));
        sleep(2);
        jack_client_close(client);
        return 0;
}

But working with jackdmp 0.70 (-:  that you can possibly use in the  
meantime.

Stephane




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: jack_set_port_connect_callback and counting connections

Stéphane Letz
In reply to this post by ondrej par

Le 5 mars 08 à 03:11, ondrej par a écrit :

> Hi all,
>
> it seems that when a JackPortConnectCallback is set up,
> jack_port_connected gives strange results. The following code prints
> "connected 2 times" if the (dummy) callback is registered, and prints
> "connected 1 times" if the jack_set_port_connect_callback is commented
> out:
>
> #include <stdio.h>
> #include <jack/jack.h>
>
> void portConnectCallback(jack_port_id_t ida, jack_port_id_t idb, int
> c, void* arg) {}
>
> int main(int argc, char**argv) {
>        jack_client_t* client = jack_client_open("testclient",
> JackNullOption, NULL);
>        jack_port_t* in = jack_port_register(client, "in",
> JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
>        jack_port_t* out = jack_port_register(client, "out",
> JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
>        jack_set_port_connect_callback(client, portConnectCallback,  
> NULL);
>        jack_activate(client);
>        jack_connect(client, "testclient:out", "testclient:in");
>
>        printf("connected %d times\n", jack_port_connected(out));
> }
>
> Also, the jack_port_get_connections report the connection twice.
>
> Thanks for reply,


Fixed in just committed SVN 0.109.5.

Stephane


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel