Re: AU from scratch
Re: AU from scratch
- Subject: Re: AU from scratch
- From: Scott Ruda <email@hidden>
- Date: Wed, 3 Dec 2003 18:54:19 -0800
On Dec 1, 2003, at 5:00 PM, nick <email@hidden> wrote:
The funny thing is, I'm having troubles getting the built-in Generic
view to work! I always end up with a blank window being displayed. Any
ideas why this could be? Where exactly does the Generic View get its
information from?
Assuming your AU derives from AUBase or one of its subclasses, you must
override a few functions. This is what I've come up with so far. Any
corrections for mistakes or additional info is welcome. I derived most
of this info by looking at the source for GenericAUView to see what it
expects from the AU it is calling.
SetParameter should be called in an overridden Initialize method for
each of your parms to set the initial values. When you override
SetParameter, make sure you call through to the super class too. The
super class registers each parm in a map to be used for subsequent
event handling and widget updating. This method is called by
GenericAUView when parms are edited and therefore is the place for you
to know a user edit has occurred. (The super class knows if it has
already created entries for each parm in its map for subsequent calls
to this method.)
GetParameterInfo is called to get each parm's info (name, type, min,
max etc.). A <fully qualified> parm ID is passed in and you return the
needed info in a AudioUnitParameterInfo struct. Presumably this is
called for each parm registered in the map entries created by the
initial calls to SetParameter.
GetParameterValueStrings is called to get the strings for indexed
parms, i.e. displayed as popups. You return a CFArray of strings that
correspond to the indices of the parm's values. (I'm not sure about the
release policy of the created CFArray though. Anyone?)
GetParameter is called to get the values for display. Note this can be
called very frequently (every 35 milliseconds) by the GenericAUView
class in order to do responsive meter object displays, so this code
here should be pretty tight.
In general you should check and see if the super class method needs to
be called through either before or after any of your overridden
methods. This is essential for some methods (like SetParameter
described above.) Some should not be called through because they are
just stubs that return not-implemented type errors and then your
overridden implementation returned values and such would be ignored if
you call it last and return its status.
That's what I've come up with, and my generic UI is working. Getting a
custom UI is a bunch more work. You can see all the stuff in the source
of GenericAUView that you need to do. I'm about half way through all
that. Ideally I'd like to use a nib for the custom view, and I'm
looking at the Airy source for guidance there.
-s
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.