Le 10/11/2014 19:44, Alessio Degani a écrit :
Thank you Patrice! The attached patch do exactly what I want! It's a little bit tricky to understand what exactly the patch does but it simply works.
Are there some drawbacks when using this approach to dynamic dac~ channel allocation? (i.e. unhandled exceptions, memory allocation, overhead, ...)
Bests
This method works pretty good nowadays indeed, sorry to not put explanation comments, but I can give some clues...
We create [dac~ n] (n is channel number) in a subpatch protected with $0 variable in subpatch name.
Instance specific dynamic patching is explained here but this is a bit old:
http://puredata.info/docs/tutorials/TipsAndTricks#instance-specific-dynamic-...
Now we can put $0 at the middle of a name, then [makefilename] method becomes obsolete.
I don't think we would go on mem alloc issues by doing simple things like this, it might happen on huge dynamic creation but I never encountered this, maybe someone that knows better pd core would give more accurate answers.
Also, I've made it fast and figured out that [t b b]-[$1] is useless, you can directly connect [loadbang] to [pack $0 $1].
Look at internal messages to know more about dynamic patching: