Hello,
i am building a project that uses several audio channels. That is all working well. No I have one question. I have build one channel and put that into a patch [pd channel] Each [pd channel] holds a [dac~ n]. If I then copy the [pd channel] and make changes in one [pd channel] changes are not reflected in the others. It seems that a copy is made from the patch, I would like to know if it is possible to make each copy a reference to a patch so that changes in one is reflected in many.
Then I also wonder if it is possible to set the [dac~ n] at 'runtime'. n otherwords is it possible to have a var setting the output channel.
I hope somebody can help me, and many thanks to those who can.
Jiri
Jiri Heitlager wrote:
a [pd] is NOT a patch but a sub-patch. it's only purpose is to make your code more readable by hiding stuff (well, not entirely true when it comes to datastructures, but ignore this for now), and NOT for re-using code. for this you have to make _abstraction_s. an "abstraction" is a pd patch saved to disk.
e.g. create a new patch ("Ctrl-N"), copy the channel-code in there, and save it as "channel.pd". now you can create objects [channel], each holding one instance of the channel-code.
of course you will have to parametrize your abstraction by use of arguments (dollargs): use [dac~ $1] within the channel.pd and call it as [channel 5] which will magically address the [dac~ 5] within this instance.
this is certainly described within the documentation that comes with pd (e.g. doc/2.control.examples/12.PART2.subpath.pd)
mfg.asdr. IOhannes
Hallo, Jiri Heitlager hat gesagt: // Jiri Heitlager wrote:
You stumbled accros the difference between a subpatch like [pd subpatch] and an abstraction, which is a complete patch saved as a seperate file in the working directory or somewhere in Pd's search path.
You want an abstraction here instead of a subpatch. To make on, just copy the contents of [pd channel] to a new file, save that as e.g. "channel.pd" and then use that instead of [pd channel] by creating an object [channel].
Then I also wonder if it is possible to set the [dac~ n] at 'runtime'. n otherwords is it possible to have a var setting the output channel.
Somehow it is: If you write your channel.pd abstraction to use a [dac $1] you can create [channel 1], [channel 2] ... [channel 16] objects, and [dac $1] will be the same as [dac~ 1], [dac~ 2] ... [dac~ 16] in the respective [channel ...] instances.
Frank Barknecht _ ______footils.org_ __goto10.org__