From 5ed5660cc0c145552ac064105d3857e60b839458 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 13 Nov 2012 05:05:55 +0000 Subject: allow setting connection in object arguments; clean up debug messages svn path=/trunk/externals/jackx/; revision=16545 --- jack-connect-help.pd | 41 +++++++++++++++++++++++++++++++++++------ jack-connect.c | 20 +++++++++++--------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/jack-connect-help.pd b/jack-connect-help.pd index 73cc00c..d6bd9a2 100644 --- a/jack-connect-help.pd +++ b/jack-connect-help.pd @@ -1,9 +1,9 @@ -#N canvas 330 283 583 302 10; +#N canvas 200 265 583 536 10; #X obj 159 206 jack-connect; -#X obj 159 247 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +#X obj 159 233 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; -#X msg 158 28 connect; -#X msg 161 55 toggle; +#X msg 138 28 connect; +#X msg 151 55 toggle; #X msg 178 105 symbol alsa_pcm; #X msg 217 149 symbol pure_data_0; #X msg 160 81 query; @@ -17,7 +17,7 @@ #X text 365 149 input client; #X text 366 171 input port; #X msg 46 29 disconnect; -#X text 207 248 output is 1 for connect(ed) 0 for disconnect(ed); +#X text 207 234 output is 1 for connect(ed) 0 for disconnect(ed); #X text 221 80 doesn't change the connection only outputs the state ; #N canvas 51 246 507 361 META 0; @@ -33,7 +33,26 @@ #X text 12 185 OUTLET_0 float; #X text 12 205 AUTHOR Gerard van Dongen; #X text 12 225 RELEASE_DATE 2003; -#X restore 519 272 pd META; +#X restore 519 502 pd META; +#X obj 99 390 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X msg 99 300 query; +#X obj 99 369 jack-connect system capture_1 pure_data_0 input0; +#X msg 108 325 connect; +#X msg 116 346 disconnect; +#X obj 99 411 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X text 8 267 you can also put the connection description as arguments +to the object:; +#X obj 187 486 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 187 399 query; +#X msg 196 421 connect; +#X msg 204 442 disconnect; +#X obj 187 507 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 187 465 jack-connect pd-extended_0 output1 system playback_2 +; #X connect 0 0 1 0; #X connect 2 0 0 0; #X connect 3 0 0 0; @@ -46,3 +65,13 @@ #X connect 10 0 0 2; #X connect 11 0 0 4; #X connect 16 0 0 0; +#X connect 20 0 25 0; +#X connect 21 0 22 0; +#X connect 22 0 20 0; +#X connect 23 0 22 0; +#X connect 24 0 22 0; +#X connect 27 0 31 0; +#X connect 28 0 32 0; +#X connect 29 0 32 0; +#X connect 30 0 32 0; +#X connect 32 0 27 0; diff --git a/jack-connect.c b/jack-connect.c index aac72ad..fbbbc1a 100644 --- a/jack-connect.c +++ b/jack-connect.c @@ -68,7 +68,7 @@ static void jackconnect_connect(t_jackconnect *x) #else logpost(x, 3, #endif - "connecting %s with %s", x->source, x->destination); + "[jack-connect] connecting '%s' --> '%s'", x->source, x->destination); if (!jack_connect(jc, x->source, x->destination)) { x->connected = 1; @@ -93,7 +93,7 @@ static void jackconnect_disconnect(t_jackconnect *x) #else logpost(x, 3, #endif - "disconnecting %s with %s", x->source, x->destination); + "[jack-connect] disconnecting '%s' --> '%s'", x->source, x->destination); } } @@ -108,7 +108,7 @@ static void jackconnect_toggle(t_jackconnect *x) #else logpost(x, 3, #endif - "toggling connection %s with %s", x->source, x->destination); + "[jack-connect] toggling connection '%s' --> '%s'", x->source, x->destination); if (jack_disconnect(jc, x->source, x->destination)) { jack_connect(jc, x->source, x->destination); @@ -135,7 +135,7 @@ static void jackconnect_query(t_jackconnect *x) #else logpost(x, 3, #endif - "querying connection %s with %s", x->source, x->destination); + "[jack-connect] querying connection '%s' --> '%s'", x->source, x->destination); ports = jack_port_get_all_connections(jc,(jack_port_t *)jack_port_by_name(jc, x->source)); x->connected = 0; @@ -165,7 +165,8 @@ static void jackconnect_query(t_jackconnect *x) } } -static void *jackconnect_new(void) +static void *jackconnect_new(t_symbol *output_client, t_symbol *output_port, + t_symbol *input_client, t_symbol *input_port) { t_jackconnect * x = (t_jackconnect *)pd_new(jackconnect_class); @@ -176,10 +177,10 @@ static void *jackconnect_new(void) symbolinlet_new(&x->x_obj, &x->input_port); /* to prevent segfaults put default names in the client/port variables */ - x->input_client = gensym("none"); - x->input_port = gensym("none"); - x->output_client = gensym("none"); - x->output_port = gensym("none"); + x->input_client = input_client; + x->input_port = input_port; + x->output_client = output_client; + x->output_port = output_port; x->connected = 0; jackconnect_getnames(x); @@ -195,6 +196,7 @@ static void setup(void) 0, sizeof(t_jackconnect), CLASS_DEFAULT, + A_DEFSYMBOL, A_DEFSYMBOL, A_DEFSYMBOL, A_DEFSYMBOL, 0); class_addmethod(jackconnect_class, (t_method)jackconnect_connect, gensym("connect"),0); -- cgit v1.2.1