Hi all,
I'm just getting familiar with Cocoa and Objective-C, and my first desire is to replace the NIB-loaded view class with a view I create in code. I've been trying to find a simple example of this, but am having a lot of trouble doing so.
One task it seems I need to tackle is in the main AUEffectBase-derived class... I need to modify the code in GetProperty for the kAudioUnitProperty_CocoaUI. The existing code is like this:
case kAudioUnitProperty_CocoaUI: { // Look for a resource in the main bundle by name and type. CFBundleRef bundle = CFBundleGetBundleWithIdentifier( CFSTR("com.audiounit.TestAU") );
if (bundle == NULL) return fnfErr;
CFURLRef bundleURL = CFBundleCopyResourceURL( bundle, CFSTR("TestAU_CocoaViewFactory"), CFSTR("bundle"), NULL);
if (bundleURL == NULL) return fnfErr;
AudioUnitCocoaViewInfo cocoaInfo; cocoaInfo.mCocoaAUViewBundleLocation = bundleURL; cocoaInfo.mCocoaAUViewClass[0] = CFStringCreateWithCString(NULL, "TestAU_CocoaViewFactory", kCFStringEncodingUTF8);
*((AudioUnitCocoaViewInfo *)outData) = cocoaInfo;
return noErr; }
Since removing the .xib file from the project, the CFBundleCopyResourceURL returns nil. So what would I do here in order to use a custom view without a nib? How do I fill iin the AudioUnitCocoaViewInfo structure?
(Obviously, I need to modify the factory, and I've also added a initWithFrame: function to the view, but at the moment I'm dealing with this property.)
Is there a simple example somewhere of an AU using a custom view created in code?
Thanks, Howard
|