[PD] Dynamic selection of dac~ channel
alessio.degani at ymail.com
Mon Nov 10 18:36:03 CET 2014
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~
And I don't 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.
Thank you very much!
More information about the Pd-list