Reading from a table in a subpatch


#1

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?


Table in Mainpatch, Read/Write objects in Subpatches
About tables: help a noob
#2

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


#3

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.


#4

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 wink)


#5

Ah ok, cool, that patch/patcher thing smile
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?


#6

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)


#7

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
#8

excellent, thanks!
I'll be able to test that tomorrow.
I assume that by "subpatchname" you mean the instance name?


#9

yes, its instance name... I've also just updated the table help to include and example of accessing parent table, and child (subpatch) table.


#10

This work with patch/patcher only, right?
It would be nice if it also worked with a subpatch.axs


#11

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


#12

ah ok, must have done something wrong here, works now indeed.
sorry for the noise