Re: AU from scratch
Re: AU from scratch
- Subject: Re: AU from scratch
- From: William Stewart <email@hidden>
- Date: Thu, 4 Dec 2003 12:36:03 -0800
On 03/12/2003, at 6:54 PM, Scott Ruda wrote:
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.
Actually, this should be done in the Constructor. Initialize has a
specific meaning for an AU, and we generally prefer that parameters can
be interacted with correctly without first having to initialize the AU.
The SampleEffectUnit does this correctly.
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.)
Why do you need to overide SetParameter? This is not a basic
requirement, and should not normally need to be done.
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.
Yes
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?)
Host should release this - so every time you are called for this you
should either create a new array, or if reusing an array, retain it.
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.
Yes - and the meter views are drawn in response to the AU telling us
that the parameter is read only (ie. it doesn't have the writable flag
set)
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.
Yes - probably the most important property for this is the Tail Time
property and the Latency as well. For (best) correct operation in Final
Cut Pro, tail time should be implemented by all AU effects. The Sample
Effect Unit in the SDK provides a pretty complete summary of the basic
requirements for a correct AU effect.
Bill
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.
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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.