Simple Example of a Collection of MKUnitGenerators, Operated from a User Interface

#import <MusicKit/MusicKit.h>
#import <MKUnitGenerators/MKUnitGenerators.h>
#import "MyCustomObject.h"

@implementation MyCustomObject

MKSynthData *pp;
MKUnitGenerator *osc,*out; 	

+ init
{
	MKOrchestra *orch = [MKOrchestra new];	
	[MKUnitGenerator enableErrorChecking: YES];	
	[orch open];	
	pp = [orch allocPatchpoint: MK_xData];	
	osc = [orch allocUnitGenerator: [OscgUGxy class]];	
	out = [orch allocUnitGenerator: [Out2sumUGx class]];	
	[osc setOutput: pp];	
	[out setInput: pp];	
	[osc setFreq: 440];	
	[osc setAmp: 0.1];	
	[osc setTableToSineROM];	
	[osc run];	
	[out run];	
	[orch run];	
	[MKConductor startPerformance];
}

+ setFreqFrom: sender
{
	[MKConductor lockPerformance];	
	[osc setFreq: [sender doubleValue]];	
	[MKConductor unlockPerformance];
}

+ setBearingFrom: sender
{
	[MKConductor lockPerformance];	
	[out setBearing: [sender doubleValue]];	
	[MKConductor unlockPerformance];
}

+ setAmplitudeFrom: sender
{
	[MKConductor lockPerformance];	
	[osc setAmp: [sender doubleValue]];	
	[MKConductor unlockPerformance];
}

@end