Tables in a subpatch are local to that subpatch and cannot be read from the main patch, right?
So is there no way to fill a table with values inside a subpatch and then read those values from the main patch?
Or is there another way to achieve something similar?
Reading from a table in a subpatch
Table in Mainpatch, Read/Write objects in Subpatches
About tables: help a noob
you can refer to a table in the parent patch using ../tablename
an example of this is in audio_in/granular_verb
you can see the table is defined (as t) in the main patch, and in the patcher subpatch it refers to it as ../t
I'm not sure I'm following... when I try to open patch/patcher (edit object definition), I get not a patcher window but the object editor,
so maybe it's not a subpatch but an object instead?
In any case, what you describe (I think) is reading a table that is located in the main patch from within a subpatch.
My aim is to read a table that is located in a subpatch from within the main patch.
I tried to enter ./mysubpatch/tablename, and some variations on that.
no luck so far.
patcher - click the edit button to see its contents.
yes, this example has the table defined in the main patch and then is used in the sub patche.
personally, I think that makes more sense, having the parent owning the data, rather than delving into a subpatches innards. (this is 'normal' from a programmers perspective)
of course, its only the table definition required in the parent... you can read and write to it, from within the subpatch, or even from different subpatches.
EDIT: fyi, i tested with a subpatch (as opposed to the patchers embedded subpatch) and that also works (as expected )
Ah ok, cool, that patch/patcher thing
I wanted to make a mechanism to fill a table with content that changes depending on some parameters.
It would be neat to place all that into a subpatch.
I guess I can put all that in a subpatch, except for the table itself.
But what if I want to have more than one instance of that subpatch, each with its own table?
yeah, thats a bit problematic, as we don't have a way to dynamically change the table name (or pass name into a subpatch) and would need quite alot of changes to do so.
with a patch/patcher, it wouldn't be too bad, as you can just cut n paste another copy, and then edit the table name.
(this at least prevents you having a load of sub patch files) - but its not ideal.
we should in theory be able to change tables so they can access using
./sub_patch_instance/table
would be good to know what @johannes thinks...
( I also need to find the bit of code that does the current ../ dereferencing as thats where the change would likely be made)
I added a "subpatchname/tablename" syntax to reference subpatch tables, it's in git now and will make it into the next prerelease.
[solved] Pd sampler.rockafella example on axoloti
excellent, thanks!
I'll be able to test that tomorrow.
I assume that by "subpatchname" you mean the instance name?
yes, its instance name... I've also just updated the table help to include and example of accessing parent table, and child (subpatch) table.
This work with patch/patcher only, right?
It would be nice if it also worked with a subpatch.axs
no, works in both axs or patchers. (just tested it, to make double sure!)
I just tend to use patcher objects in help files, as this makes the help file self contained