Forums > MaxMSP

SubPatches modifications

March 16, 2010 | 4:08 pm

Hello !

I have a basic question. I would like to modify a subpatch which is used a lot of time in my main patch. I would like to know if there is a way to modify all the subpatches of the same name at the same time.

Thanks

Mathieu



EMV
March 16, 2010 | 4:41 pm

Use abstractions instead. This means:
1. Save one of your subpatchers (suppose it’s named [p mysub] as a new file (for example mysub.maxpat), in a location where Max can find it (either in the same directory as your main patch or somewhere in the Max search path).
2. Use the saved subpatcher (= abstraction) in your main patch by typing its (file)name directly into a new empty object box. [mysub]
3. The new object will be an instance of the saved abstraction. Changes to the abstraction can only be made by modifying the original file (right click on the object, choose Object > Open Original) Those changes will be reflected in the instanced objects when you save the original.


March 16, 2010 | 8:46 pm

The way mentioned is very good, and is definitely something to know about (also [bpatcher] which works similarly but the interface is right in the main patch, not in a popup window). Tons of power there when you understand the possibilities, like stacking [bpatchers] and switching which one is on top with a [tab] (scripting messages to bringtofront the selected bpatch).

If you still want to use subpatches, and there are advantages to that method as well, you may be able to get away with Paste Replace: make the alterations to one subpatch, then Copy, then highlight all the other subpatches and do Paste Replace. Try it and see if it works, it should…

Another object to look into is [patcherargs] which does something similar to the #1 #2 etc. arguments with abstractions/bpatchers. So it will let you utilize arguments in a subpatch by naming it something like

p my_subpatch 1 55 (note the spaces after the name, to provide arguments)

If you bang a [patcherargs] object in the subpatch, you’ll get the numbers 1 and 55 to work with as you see fit, in that subpatch only. So you can keep the layout inside the same, but do different things (like the 1 goes to a preset or something) in each subpatch, based upon the arguments you provide. The only caveat is that [patcherargs] won’t send out newly-entered arguments automatically (the way an abstraction/bpatcher will initialize its arguments when you save it). You have to manually bang the [patcherargs], which is best done with send/receive from the main level, to bang all of them at once.

Lots of options!


March 17, 2010 | 9:30 am

Thanks a lot EMV and seejayjames !

I am now keeping a saved version of each subpatch to be more efficient.

By the way :

"If you still want to use subpatches, and there are advantages to that method as well, you may be able to get away with Paste Replace: make the alterations to one subpatch, then Copy, then highlight all the other subpatches and do Paste Replace. Try it and see if it works, it should…"

It works ! Thanks for the advice

Have a nice day

Mathieu


Viewing 4 posts - 1 through 4 (of 4 total)