Repeating bpatcher elements as individual instances?

speedo's icon

I have an interface I'm working on. It is basically a synth voice that I want to repeat 16 times as individually controllable GUIs. So I built the main synth patch and made a perf view for it. Then I made a new patcher and opened the synth in a bpatcher. Next I simply copied the bpatcher 15 more times.

The first thing I noticed is that the entire patcher responds to input as a group. The dials and some other controls change individually - but [buffer~] for instance seems to globally change all 16 voices to the same file rather than individually. Some other functions like MIDI input range also change globally.

So I guess my question is this: How can I repeat bpatchers so that each one is individually contained and behaves on its own?

thanks,

speedo

Frans-Jan Wind's icon

You should probably make the buffer names dynamic (different names per bpatcher). If they share the same name they share the same spot in memory.

Jesse's icon

Take a look at the patcherargs object - this will help you with assigning unique buffer names by using arguments you've entered in the bpatcher inspector.

MIB's icon

use #0 in front of any name like "#0_mybuffer" to generate a unique random number inside an abstraction/bp.

otherwise go with what Jesse said. Although you don't necessarily need the patcherargs obect. #1, #2, #3 etc. will do the trick as well ;)

(karrrlo)'s icon

you can give arguments in the bpatcher's info window, look for the "arguments" tab. place the #1, #2, #3... where your arguments need to show in the original instance.

speedo's icon

Having a little trouble figuring this out. If my buffer is inside a subpatcher can/should I add #0 to the subpatcher name? Is this all documented somewhere?

Jesse's icon

You add it to the name of the buffer in each subpatcher.

speedo's icon

I found the documentation for this in the encapsulation section. I think I want to make it as dynamic as possible. I don't want to have to add fixed attributes or variables to each individual bpatcher element as the whole point is that it be reusable in any number of instances. Still a little hazy on this, but will try to figure it out - thanks.

speedo's icon

Ha! I think I figured out the problem and it's not directly related to the buffer~. It's the send and receive objects conflicting with my hierarchy.

My original patch has a number of send and receive objects in it. So when it is multiplied within the bpatcher ALL of the send and receives are responding to the same messages rather to the individual subpatchers.

The subpatcher has like 30 send and receive objects. Is there a way to make them respond only to their level without completely reassigning objects?

Chris Muir's icon

Prefix all your send and receive names with #0 for example #0_my_name. The #0 will be replaced with a unique number per instance.

speedo's icon

Oh, so it works with those objects too? Wow, what a trick this #0 thing. It should be documented somewhere. Maybe it is and i just didn't see it.

Thanks all!

Chris Muir's icon

I'm sure that it's it the doc, but I couldn't find it with a couple searches. Looking for stuff like this was much easier when the doc was a .pdf file.

speedo's icon

One problem I'm having now. It seems that the random number generated changes between a patcher and poly~. So I cannot get the send objects in the parent patcher to communicate with the receive objects in the poly~ as their numbers are different.

Chris Muir's icon

It's unique for each patch, and poly~ makes new patches. You'll have to pass in #0 into poly~