I forgot to cue this mail to list, here it is

-------- Message transféré --------
Sujet :         Re: [PD] Dynamic selection of dac~ channel
Date :  Mon, 10 Nov 2014 19:12:06 +0100
De :    patrice colet <[email protected]>
Pour :  Alessio Degani <[email protected]>



hi

Le 10/11/2014 18:36, Alessio Degani a écrit :
Hi List,

I've a simple abstraction that instantiate a single output channel
plus a VU meter and a mute switch. In this abstraction I create a dac~
object. I would like to make this channel selectable by a creation
argument.
This is simple to obtain by using the object [dac~ $1] but this make
mandatory for the user so give the channel number as a creation argument.
If I instantiate the abstraction without a creation argument, $1 will
be 0, and thus, I've no output to the dac.

What I want is:
- when the patch is instantiated as [patch_name channel_num], the dac~
object in that patch should be [dac~ channel_num]
- when the patch is instantiated as [patch_name], the dac~ object in
that patch should be [dac~ 1] (or other default channel)

I've temporarily resolved this using throw~, since the throw object
accept the message [set bus_name(, but in this way, I'm forced to
create the correspondant [catch~ bus_name] and link them to a given
[dac~ channel_num].
And I don't want this! :)


why don't you want this?
Basically, I need a procedure to set the dac~ channel during the init
of an abstraction to $1 if passed or to default_channe il $1 is not
passed.


there is a way with dynamic patching, dac~ could be created at
abstraction init with default arg, if you don't know how to do this I've
attached an example
Thank you very much!





#N canvas 1 51 450 300 10;
#N canvas 458 51 450 300 \$0-dac 1;
#X restore 224 48 pd \$0-dac;
#X obj 11 48 s~ \$0-dac-r;
#X obj 12 6 inlet~;
#X obj 14 239 s pd-\$0-dac;
#X obj 14 184 pack \$0 1;
#X msg 14 205 clear \, obj 10 10 r~ \$1-dac-r \, obj 10 50 dac~ \$2
\, connect 0 0 1 0;
#X obj 14 122 loadbang;
#X obj 14 143 t b b;
#X obj 46 162 \$1;
#X connect 2 0 1 0;
#X connect 4 0 5 0;
#X connect 5 0 3 0;
#X connect 6 0 7 0;
#X connect 7 0 4 0;
#X connect 7 1 8 0;
#X connect 8 0 4 1;

#N canvas 332 447 450 300 10;
#X obj 138 45 osc~ 440;
#X obj 139 83 *~ 0.1;
#X obj 140 119 dyndac~;
#X connect 0 0 1 0;
#X connect 1 0 2 0;

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to