Two MKUnitGenerator instances communicate
via a patchPoint. The patchPoint's memory space must match the space
of the input or output to which it is connected. Connections are made
by sending an appropriate message to the
MKUnitGenerators with the patchPoint as an
argument.
There are two ways to specify the connections:
1. In the init method.
2. In the MKPatchTemplate itself.
It is a bit easier to specify the connections in the init method. The only advantage of using the
MKPatchTemplate is that it allows
MKSynthPatches to be more easily edited using a
patch editor, since the connections can be stored as data using the
NXTypedStream mechanism. For now, we will address only the init approach.
Let's continue our example. To make it easy to read, let's define some macros:
#define OSC [self synthElementAt: osc]
#define OUT [self synthElementAt: out]
#define PATCHPOINT [self synthElementAt: patchpoint]
+ init
{ [OSC setOutput:PATCHPOINT];
[OUT setInput:PATCHPOINT];
return self;
}
|