Subpatchers and Abstractions in Depth
Subpatchers and abstractions are supported in RNBO and behave much like their counterparts in Max and Gen. RNBO uses the .rnbopat file extension when saving and loading RNBO patcher files separately from a Max patcher.
To save a
.rnbopat file to disk, you must use the "Save As..." command while the RNBO patcher window is in focus. Issuing a standard Save command will instead save the containing Max patcher.
In rnbo~ objects, subpatchers are created with the p object. The p object accepts one optional argument to set the title of the subpatcher. The title is used for the name of the subpatcher titlebar, as well as for sending messages to contained param objects.
All RNBO subpatchers begin with a single inlet that can be used with the set object to send mute messages to the subpatcher. Additional inlets and outlets are created using indexed in (or in~) and out (or out~) objects.
Subpatchers can also be created using encapsulation, just like in Max, by highlighting a group of objects and using the Edit > Encapsulate command from the menubar.
Like standard Max abstractions, RNBO abstrations are saved RNBO patchers that are called by creating an object with the name of the saved file in a RNBO patcher. Unlike in Max and Gen, abstractions in RNBO are always called using the
@file attribute of the rnbo operator. For example, if a RNBO patcher is saved somewhere in Max's filepath with the name "my_differential.rnbopat", it could be instantiated as an abstraction using
p @file my_differential.
The referenced file is loaded in read-only mode, so you must click on the Modify Read-Only icon in the bottom left of the toolbar to edit the patcher.
Subpatchers and abstractions both support RNBO parameters. Any param or param~ object in a RNBO subpatcher or abstraction is exposed in the rnbo~ attribute list or exported code in the format
patchername/paramname/value. The patchername, when not explicitly defined, will default to
rnbo_obj-x, where x is an index of the total number of RNBO operators created so far in the rnbo~ object patcher.
User-defined patchernames can be created for both subpatchers and abstractions using the
@title attribute in the rnbo operator object box. For example if you create an object using
rnbo @title mysub, not only will the subpatchers title bar have the name "mysub", but any contained parameters will show up as attributes in the format
mysub/paramname. Additional subpatchers with the same name are automatically given an array index (
mysub, etc.). Subpatchers can also use the title argument instead of the @title attribute, however abstractions cannot.
Support for unique identifiers using pound sign with a non-zero integer (#1 , #2, #3...) can be set for subpatchers and abstractions.
In the p objectbox, set an
@args argument, followed by the names of attributes of objects you want to substitute with your unique identifier.
Setting an object with a name determined in the
@args allows for replacement of that specific argument with a unique identifier using a pound sign followed by a non-zero integer.
NOTE: Inside a Max abstraction, all objects with
#N arguments reveal the value set from the abstraction when the patcher is locked. This feature is not supported in RNBO abstractions or subpatchers. When locking the subpatch window, it will always show
A unique identifier can be set for buffer and both send /receive objects in subpatchers and abstractions.
By prefixing the argument with
<send local:bla> or
<buffer local:foo> the buffer or send/receive objects will not interfere with other similarly named objects in other subpatchers/abstractions.
.rnbopat file can also be loaded directly into the Max object by typing the name of the file, minus the
.rnbopat extension, as an argument after the object name. Simply dragging and dropping the
.rnbopat from the file location or the file browser into the Max object will load that object as well.