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 <colet.patrice@free.fr>
Pour : Alessio Degani <alessio.degani@ymail.com>


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!
>