Connecting MKUnitGenerators

To connect two MKUnitGenerators, you use a "patchpoint", a kind of MKSynthData, which you can allocate from the MKOrchestra. You must be sure to specify the memory space corresponding to the memory space of the input/output that the MKUnitGenerators will be reading/writing. Example:

MKSynthData *pp;	
MKUnitGenerator *osc,*out; 	
MKOrchestra *orch = [MKOrchestra new];	
[orch open];	
pp = [orch allocPatchpoint: MK_xPatch];	
osc = [orch allocUnitGenerator: [OscgUGxy class]];	
out = [orch allocUnitGenerator: [Out1aUGx class]];	
[osc setOutput: pp];	
[out setInput: pp];	
[osc setFreq: 440];	
[osc setAmp: 1.0];	
[osc setTableToSineROM];	
[orch run];	
[osc run];	
[out run];	
/* You now hear a full-amplitude sine wave at 440 hz */	
      

Patchpoints may be reused, if you're careful about the order in which MKUnitGenerators run. (More on this later.)