• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Modifying basic AU to create view without NIB?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying basic AU to create view without NIB?


  • Subject: Re: Modifying basic AU to create view without NIB?
  • From: Brian Willoughby <email@hidden>
  • Date: Fri, 21 Jan 2011 12:39:19 -0800

This property returns two pieces of information: The URL of a bundle, and the name of an Objective C class. You cannot change the design of this property, and thus you must return a valid URL of a bundle that will successfully load, and that bundle must contain dynamically loadable ObjC code that provides the named class. More specifically, if CFBundleCopyResourceURL() is returning nil, then something is wrong with your bundle, or it is not located anywhere that it can be found. Fix that first before trying to move on.

Brian Willoughby
Sound Consulting


On Jan 21, 2011, at 12:21, Howard Moon wrote:
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?


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Modifying basic AU to create view without NIB? (From: Howard Moon <email@hidden>)

  • Prev by Date: Modifying basic AU to create view without NIB?
  • Next by Date: Re: Modifying basic AU to create view without NIB?
  • Previous by thread: Modifying basic AU to create view without NIB?
  • Next by thread: Re: Modifying basic AU to create view without NIB?
  • Index(es):
    • Date
    • Thread